• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to implement Request Time Out

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to implement Request Time Out in Web Application?

If request doesn't respond in 30Sec system should show Request Time Out Page.




How do I implement the same?
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about Session timout?

If yes, you can configure using


or you can specify by calling public void setMaxInactiveInterval(int interval) of HttpSession classhttp://java.sun.com/products/servlet/2.2/javadoc/

The difference between the two is using the xml approach you can specify in minutes where as using the API you can set session timeout in seconds.
 
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can configure a listener which will check for the session and redirect to error page if session is null;
 
shashi wagh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know about the Session Time Out. n web.xml setting n all



I want to Implement Request Time Out.......


Say I put request http://localhost:8080/HRMS/GetEmployee.do Servlet

It will hit the server and shows the Response on the browser.
I want the request should process within the specifies time Say 1 Sec.

If it takes more than 1 Sec. It should redirect to Some other page showing the Request Time is Out


 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use javascript which will start counting when a page is loaded and will redirect to a url as soon as the counting is over.
 
shashi wagh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain more how do I achieve the same using Javascript?

Sample Code or URL?
 
shashi wagh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Develop following Login
But It shows the Time out page After processing the request i.e. after 4 Sec.

I want to halt the Request Processing in 1 Sec.

Filter Code

--------------------------------------------------------------------------------------------------------
Timer


I have also tried



------------------------------------------------------------------------------------------------------------------------------
Next Jsp

----------------------------------------------------------------------------------------------------
Result on Consol
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shashi wagh wrote:I have Develop following Login
But It shows the Time out page After processing the request i.e. after 4 Sec.

I want to halt the Request Processing in 1 Sec.

Filter Code

--------------------------------------------------------------------------------------------------------
Timer


I have also tried



------------------------------------------------------------------------------------------------------------------------------
Next Jsp

----------------------------------------------------------------------------------------------------
Result on Consol



Dear Sashi,

Is this code working at your end? Actually m also looking out a soln for similar prob. I am not able to call that error.jsp from request time listener class.
 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try using this one. This isnt exactly what you want, but something similar. Clicking on a button takes you to another page. Here you have another button. You either click it within a certain time interval, or you get timed out and sent to a different page.
Hope this helps you.

I'll just give you the relevant servlet code. The rest (mapping, jsp etc) should be easy.



showsessiontime.jsp


timedout.jsp

 
Oh. Hi guys! Look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic