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 properly handle server Timeout ?

 
Franck Tranchant
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I'm currently working on a struts-based application running on Weblogic 7.0 and I wonder how to properly handle server Timeout.
For the moment, i've nothing special configured/coded so, when the weblogic "Session Timeout" for my application happens, naturally, i do have an horrible error message on screen due to NullPointerExceptions in the Action class.

So, how could I detect the timeout and then forward to a specific JSP ?
Many thanks in advance..
 
Junilu Lacar
Bartender
Pie
Posts: 6529
21
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One option is to use a Filter configured for your ActionServlet. You would set a session-scoped attribute and the filter would check for it.
Another option is to use the Token mechanism in the Action class. See http://www.husted.com for examples in using the Struts token.
 
Franck Tranchant
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about this one :
In every Action class, I first check the
request.isRequestedSessionIdValid() boolean flag at the begining of the execute method.
The false value throws an Exception that can be caught and forward the user to a particular JSP with the right error message.
Works fine for me.
What do you think ? Does it make sense to you, Struts experts ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic