Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jeteam.util.web
Class HttpSessionUtil  view HttpSessionUtil download HttpSessionUtil.java

java.lang.Object
  extended byorg.jeteam.util.web.HttpSessionUtil

public class HttpSessionUtil
extends java.lang.Object

This utility class is a singleton that is designed to wrap the functionality of a user's session.

This means all the data that persists into the session after a user has logged in.


Field Summary
static short INITIALIZED
          Use this value to indicate whether or not the session has been properly set up, in some cases you might need this before trying to use some attributes that are expected to be set.
private static java.lang.String[] KEYS
           
static short LOGIN_DATE
          This value is used for the login date and time.
static short PRIVILEGES_PERMISSIONS
          This value is used for the privileges-permissions for a specific user.
static short PROJECTS
          This value is used for the projects for a specific user.
static short SETTINGS
          This value is used for the settings for a specific user.
static short USER
          This value is used for the user owning this session.
 
Constructor Summary
protected HttpSessionUtil()
          This class should not be instantiated directly.
 
Method Summary
static java.lang.Object getAttribute(javax.servlet.http.HttpSession session, short attributeType)
          Returns the session attribute specific by the attribute type, the constants defined in this class can be used as an argument here.
static void setAttribute(javax.servlet.http.HttpSession session, short attributeType, java.lang.Object value)
          Sets the session attribute specific by the attribute type, the constants defined in this class can be used as an argument here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIVILEGES_PERMISSIONS

public static final short PRIVILEGES_PERMISSIONS
This value is used for the privileges-permissions for a specific user.

The object mapped in the session is a Collection of Strings, each String instance is a permission of a user privilege.

See Also:
Constant Field Values

SETTINGS

public static final short SETTINGS
This value is used for the settings for a specific user.

The object mapped in the session is a Collection of SettingVOs. Each value object is a user specific setting.

See Also:
Constant Field Values

USER

public static final short USER
This value is used for the user owning this session.

The object mapped in the session is a UserDTO instance.

See Also:
Constant Field Values

LOGIN_DATE

public static final short LOGIN_DATE
This value is used for the login date and time.

The object mapped in the session is a java.util.Date.

See Also:
Constant Field Values

PROJECTS

public static final short PROJECTS
This value is used for the projects for a specific user.

The object mapped in the session is a Collection of ProjectVOs. Each value object is a project to which this user is registered.

See Also:
Constant Field Values

INITIALIZED

public static final short INITIALIZED
Use this value to indicate whether or not the session has been properly set up, in some cases you might need this before trying to use some attributes that are expected to be set.

An example is where a user logs in but does not go to the index page, rather he goes directly to one of the pages that require some more session information that normally is set through an action or something.

This value can be used to test if this session is in a ready state, the information required by the pages is properly set.

The object mapped in the session is a java.lang.Boolean instance.

See Also:
Constant Field Values

KEYS

private static final java.lang.String[] KEYS
Constructor Detail

HttpSessionUtil

protected HttpSessionUtil()
This class should not be instantiated directly.

THe modifier is made protected in case one would like to extend this class.

Method Detail

setAttribute

public static void setAttribute(javax.servlet.http.HttpSession session,
                                short attributeType,
                                java.lang.Object value)
Sets the session attribute specific by the attribute type, the constants defined in this class can be used as an argument here.

Make sure that the argument object value is of the appropriate type (see JavaDoc for the public constants).


getAttribute

public static java.lang.Object getAttribute(javax.servlet.http.HttpSession session,
                                            short attributeType)
Returns the session attribute specific by the attribute type, the constants defined in this class can be used as an argument here.

In case the value has previously been set correctly, you should receive an object of the type as described in the JavaDoc corresponding to the public constants.