GeeCON Prague 2014*
The moose likes JSP and the fly likes Client-side Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Client-side Listener" Watch "Client-side Listener" New topic
Author

Client-side Listener

Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Hello All,
I'm researching an issue which has come up in a JSP/Servlet web application. Specifically, the application requires a real-time communication link between the client and server. So, for example, the client sends a request to the server to run job Foo. The server takes its time, completing job Foo in 3 minutes.

Now, how can the server actively send a completion notice to the client?

Naturally, we're moving beyond the capabilities of a simple HTTP server in order to establish a two-way messaging routine between client and server. I'd like to stay away from a mechanism that simply polls the web server until the job is complete. So, applet, JMS? I'm not sure what the best route to go is, so if anyone has experience with this issue, I'd appreciate suggestions.

Thanks!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
XMLHttpRequest() would help you I think....
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Socket programming with applets is not too difficult.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Thanks, guys. The applet was our immediate solution, but we are after something a bit more efficient. Our goal is to maintain a "connection" between the client-server, and have communication occur in the background. It appears that the XMLHttpRequest object serves exactly this purpose.

Thanks, Eric, for providing this tip.
 
GeeCON Prague 2014
 
subject: Client-side Listener