Class SessionData

java.lang.Object
org.openxava.util.SessionData

public class SessionData extends Object
To access session data without having access to HttpServletRequest or HttpSession.

It has to be used from inside an OpenXava request, though you can use it in any part of your application: JSPs, actions, calculators, validators, entities, etc.
An advantage of using this class over direct request.getSession() is that it abstracts your code from web technology, so that code could work in other contexts, as Swing for example.

Since:
5.7
Author:
Javier Paniza
  • Constructor Details

    • SessionData

      public SessionData()
  • Method Details

    • setCurrent

      public static void setCurrent(javax.servlet.http.HttpServletRequest request)
      To use SessionData in your own servlet first call to this method.
    • clean

      public static void clean()
      If you use SessionData in your own servlet call to this method at end.
    • get

      public static Object get(String key)
      If not session available returns null.
    • put

      public static void put(String key, Object value)
      Throws:
      IllegalStateException - If not session available.
    • remove

      public static void remove(String key)
      Throws:
      IllegalStateException - If not session available.