File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement Request Time Out

 
shashi wagh
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Anky Singhal
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • 0
  • Mark post as helpful
  • send pies
  • 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

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic