File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specfying TimeOut for a Request

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi ,

Is there anyway where i can specify Timeout for a request from a browser.

I am not sure whether the below is related for acheving this ??

response.sendError(response.SC_GATEWAY_TIMEOUT,
"Timeout");
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please clarify what you are asking for.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anyway where i can specify Timeout for a request from a browser.

I think you need Session TimeOut.You can specify it in Web Deployment Descriptor (web.xml).
 
Paul Clapham
Sheriff
Pie
Posts: 20170
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the browser sends a request, it will define a timeout period. If it has not received a response within that period, it will tell the user that.

You can't affect that timeout period, if that's what you are asking.
 
Alok Kushwah
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If scenario is as follows

- browser send request for some resource and wait for response.
- If browser get the response within x seconds display the resource.
- If browser does not get the response within x seconds display the timeout message.

Solution:

1. Open the page/resource in frame/iframe or use ajax
2. Use javascript function setTimeout("declare_timeout()",5000) for waiting for resource to download.
3. in declare_timeout() javascript function change url of frame/iframe to timeout page.
4. To clear the timout after page/source dowload use clearTimeout().

Notes: you can check some condition in step 3 to check dowload is completed before decalring timeout.

resource: http://www.w3schools.com/js/js_timing.asp
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alok for your excellent explanation .

Thanks Paul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic