What is best way of handling session expiration in WebLogic?


Web tier: servlets, JSP, Web frameworks: What is best way of handling session expiration in WebLogic?

  1. Is there a standard, out-of-the box WebLogic solution for handling session expiration events? We are planning to implement a homegrown solution wherein we test to detect that the session is invalid (due to expiration) and then route the user to an error page. But surely there must be an easier way to handle this situation?

    Has anyone found a technique that is easier than putting session handling logic in all your JSP and servlet code?

  2. I dont know about out-of-the-box solutions for WebLogic. But, if you use the MVC approach and have controller servlets that are sub-classed from an abstract servlet class, you can check for expired sessions and do the appropriate redirection from within a dispatch method of the base class. Thus, you dont have to spread this common logic all over the place.

    But how does one determine if the session has expired or if one does not exist in the first place?.

  3. Kevin,

    instead of working on your onw home grown solution you might want to wait a while ( if you could ) untill WebLogic will comply with the Servlets 2.3 Spec where you could use the:
    1. sessionWillPassivate(HttpSessionEvent se) method of the HttpSessionActivationListener..or
    2. sessionDestroyed(HttpSessionEvent se) method of the
    to catch the session ending event.

    Until you wait you could use the Tomcat 4.0 ( Beta 3 is out I think ) which fully supports the Servlets 2.3 and JSP 1.2 specs.

  4. Nicky, thanks for the reply. That is good to know.

    Unfortunately, we will have to implement some interim solution, but it seems like it will make sense to limit the efforts as much as possible with the expectation of using the new 2.3 features ASAP.

    I can go dig this up myself, but do you have any idea if WebLogic 6 supports this yet? We're stuck on 5.1 until summer.