This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Submitting web request in intervels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Submitting web request in intervels" Watch "Submitting web request in intervels" New topic
Author

Submitting web request in intervels

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Hi ,
In one of my applications i have to submit a web request and check whether the results are available, i have to do this in intervels automatically.
It is in a web application.

Do i have to go for threads or is there is other best way to trigger a piece of code.

Thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

So is your client just waiting for the results? Since it is a web application, your client might be on a completely different web page or even web site, so you would be able to have your client do a check. Unfortunately the nature of the web application is the request/response format. Meaning you send a request get a response and move on. If you want to do a request, go somewhere else while this does its work, then get a response, is against the architecture and nature of the web. Your browser is going to wait for the response.

Now if you want the Servlet to move on, and not have to worry about the "thread" finishing to handle some other request, then you can pass the Request and Response objects to a new Thread, and let that Thread return a response.

But, I could be wrong.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you don't mind using frames, you can have one frame that just polls to check the results. You can even make it a hidden iframe so it doesn't distract the user when refreshing.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Originally posted by Ben Souther:
If you don't mind using frames, you can have one frame that just polls to check the results. You can even make it a hidden iframe so it doesn't distract the user when refreshing.


True, but that won't help him if the user goes to a completely different Website while waiting.

Mark
 
 
subject: Submitting web request in intervels
 
Similar Threads
redirect a request to another Web site
When is a HttpSession object created by the Web Container
Https request
Connecting Tomcat to JBoss
Web Service Request Validation against WSDL