com.jfw.web.util
Class DataContainerManager

java.lang.Object
  extended by com.jfw.web.util.DataContainerManager

public final class DataContainerManager
extends java.lang.Object

Manage objects of type DataContainer.
The DataContainer objects are saved:

  1. in the HttpSession: in this case are relative of the user
  2. in this class (atrtibute appDataContainer): is application relative and can be used for all users.
All public methods are static and thread safe.

Methods get(javax.servlet.http.HttpServletRequest, java.lang.String) is used for create/get an object DataContainer.
The method remove(javax.servlet.http.HttpServletRequest, java.lang.String) is used for delete an object DataContainer from the session.


Field Summary
static java.lang.String DATA_CONTAINER_KEY
          The default key value when add object DataContainer in session.
static int DATA_CONTAINER_KEY_LENGTH
          Length of attribute DATA_CONTAINER_KEY.
 
Constructor Summary
DataContainerManager()
           
 
Method Summary
static DataContainer get()
          Manage the application object DataContainer.
static DataContainer get(javax.servlet.http.HttpServletRequest request)
          Use method get(javax.servlet.http.HttpServletRequest, java.lang.String).
static DataContainer get(javax.servlet.http.HttpServletRequest request, java.lang.String suffix)
          Manage an object DataContainer.
static boolean remove(javax.servlet.http.HttpServletRequest request)
          Use method remove(javax.servlet.http.HttpServletRequest, java.lang.String).
static boolean remove(javax.servlet.http.HttpServletRequest request, java.lang.String suffix)
          Delete a data container from HttpSession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_CONTAINER_KEY

public static final java.lang.String DATA_CONTAINER_KEY
The default key value when add object DataContainer in session.

See Also:
Constant Field Values

DATA_CONTAINER_KEY_LENGTH

public static final int DATA_CONTAINER_KEY_LENGTH
Length of attribute DATA_CONTAINER_KEY.

Constructor Detail

DataContainerManager

public DataContainerManager()
Method Detail

get

public static DataContainer get(javax.servlet.http.HttpServletRequest request,
                                java.lang.String suffix)
Manage an object DataContainer.
The object is saved in HttpSession, associated with key getKey(java.lang.String). If the object is not exist in HttpSession is created.

Parameters:
request - an HttpServletRequest object.
suffix - the suffix to use for the session key. The prefix is the value of attribute DATA_CONTAINER_KEY. The complete key is returned by method getKey(java.lang.String).
Returns:
the DataContainer object relative with the suffix.

get

public static DataContainer get(javax.servlet.http.HttpServletRequest request)
Use method get(javax.servlet.http.HttpServletRequest, java.lang.String). The default value of parameter suffix is null.

Returns:
the DataContainer object.

get

public static DataContainer get()
Manage the application object DataContainer.
The object is saved in attribute appDataContainer.

Returns:
the attribute appDataContainer.

remove

public static boolean remove(javax.servlet.http.HttpServletRequest request,
                             java.lang.String suffix)
Delete a data container from HttpSession.

Parameters:
request - an HttpServletRequest object.
suffix - the suffix of key used in HttpSession.
Returns:
true if object found in HttpSession, false in other case.

remove

public static boolean remove(javax.servlet.http.HttpServletRequest request)
Use method remove(javax.servlet.http.HttpServletRequest, java.lang.String). The default value of parameter suffix is null.