Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Specfying TimeOut for a Request

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please clarify what you are asking for.
 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Sheriff
Posts: 26955
83
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Alok for your excellent explanation .

Thanks Paul.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic