• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to do Server pushing?

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am working on a product that mainly tracks BPO daily activities.
Product based on 3 tiers Architecture (JSF,EJB2.0 and MSSQL).
There are many teams across the globe using this Application.
And their shift timings differ.

Say team A, the shift timing starts @ 2:30P.M (configurable) . Depending upon
the work load, they might need to log-on before 2:30P.M. In that case, that period
will be considered as over time.
My requirement is to display an message at 2:30 P.M. indicating that
their normal shift-timing starts by now.


That's the challenging part. In my understanding, I need to apply somekind of
server pushing concept.
Any better idea or approach?

Regards
Gautam
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot push anything over HTTP, and therefore you cannot push over JSF. HTTP is based on a Request/Response cycle and there's no allowance for unsolicited responses or multiple responses for a request in the HTTP standard.

The best you can do in that regard is to poll the server periodically, which would be done either by adding a refresh meta-tag to the page or by having a client-side JavaScript process running to do AJAX requests. Of course, this only works when the page containing the meta-tag or JavaScript is actually being displayed in the browser. I suppose you could pop up a separate browser window for that purpose, even though as a general rule I don't like pop-up windows.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I think it would be difficult to implement server push functionality as the server would have to send response to the client without the client actually making any request for it.

What you can do is, upon each employee login, you can check whether the login takes place before the actual shift start time or not, and if it does start before the actual time then you can calculate the difference in timing and send this timing difference back to the client browser, where you can have javascript code which waits for the time difference to elapse and then acts by firing up a popup window informing the user that the shift starts now.
Also you can make a request to the server when the pop up appears/user user clicks on the popup to do the required server side stuff.

~ Moin
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alternatively, you could use the a4j:poll tag. That tag will periodically poll the server, and can then update another a4j region or component. In this case, you could update the area that displays if a user is in his shift or not.

To prevent to many polls, you could set the interval to the total time the user has left before his shifts ends.

See: http://docs.jboss.org/richfaces/3.3.2.GA/en/devguide/html/a4j_poll.html
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Gerbrand is right.... This helped me in my scenario, may be helpful in your scenario also. <a4j:poll> rocks in these type of scenarios
 
Oh. Hi guys! Look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic