Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Submitting web request in intervels

 
Archana Annamaneni
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic