com.hazelcast.web.tomcat
Class HazelcastSession

java.lang.Object
  extended by org.apache.catalina.session.StandardSession
      extended by com.hazelcast.web.tomcat.HazelcastSession
All Implemented Interfaces:
Serializable, javax.servlet.http.HttpSession, org.apache.catalina.Session

public class HazelcastSession
extends org.apache.catalina.session.StandardSession

Author:
ali
See Also:
Serialized Form

Field Summary
protected static String info
          Descriptive information describing this Session implementation.
 
Fields inherited from class org.apache.catalina.session.StandardSession
accessCount, ACTIVITY_CHECK, attributes, authType, containerEventMethod, containerEventTypes, creationTime, EMPTY_ARRAY, excludedAttributes, expiring, facade, id, isNew, isValid, lastAccessedTime, listeners, manager, maxInactiveInterval, NOT_SERIALIZED, notes, principal, sessionContext, sm, support, thisAccessedTime
 
Fields inherited from interface org.apache.catalina.Session
SESSION_ACTIVATED_EVENT, SESSION_CREATED_EVENT, SESSION_DESTROYED_EVENT, SESSION_PASSIVATED_EVENT
 
Constructor Summary
HazelcastSession(org.apache.catalina.Manager manager)
          Construct a new Session associated with the specified Manager.
 
Method Summary
 void activate()
          Perform internal processing required to activate this session.
 void expire(boolean notify)
          Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
 Object getAttribute(String name)
          Return the object bound with the specified name in this session, or null if no object is bound with that name.
 Enumeration getAttributeNames()
          Return an Enumeration of String objects containing the names of the objects bound to this session.
 Object getLocalAttribute(String name)
          Get HazelAttribute directly
 javax.servlet.http.HttpSession getSession()
          Return the HttpSession for which this object is the facade.
protected  String[] keys()
          Return the names of all currently defined session attributes as an array of Strings.
protected  void notifyRemove(String name, Object value, boolean notify)
           
 void passivate()
          Perform the internal processing required to passivate this session.
protected  void readObject(ObjectInputStream stream)
          Read a serialized version of this session object from the specified object input stream.
protected  void removeAttributeHard(String name, boolean notify)
           
protected  void removeAttributeInternal(String name, boolean notify)
          Remove the object bound with the specified name from this session.
 void setAttribute(String name, Object value, boolean notify)
          Bind an object to this session, using the specified name.
 void setId(String id)
          Set the session identifier for this session.
protected  void writeObject(ObjectOutputStream stream)
          Write a serialized version of this session object to the specified object output stream.
 
Methods inherited from class org.apache.catalina.session.StandardSession
access, addSessionListener, endAccess, exclude, expire, fireContainerEvent, fireSessionEvent, getAuthType, getCreationTime, getId, getIdInternal, getInfo, getLastAccessedTime, getLastAccessedTimeInternal, getManager, getMaxInactiveInterval, getNote, getNoteNames, getPrincipal, getServletContext, getSessionContext, getValue, getValueNames, invalidate, isNew, isValid, isValidInternal, putValue, readObjectData, recycle, removeAttribute, removeAttribute, removeNote, removeSessionListener, removeValue, setAttribute, setAuthType, setCreationTime, setManager, setMaxInactiveInterval, setNew, setNote, setPrincipal, setValid, tellNew, toString, writeObjectData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

info

protected static final String info
Descriptive information describing this Session implementation.

See Also:
Constant Field Values
Constructor Detail

HazelcastSession

public HazelcastSession(org.apache.catalina.Manager manager)
Construct a new Session associated with the specified Manager.

Parameters:
manager - The manager with which this Session is associated
Method Detail

getSession

public javax.servlet.http.HttpSession getSession()
Return the HttpSession for which this object is the facade.

Specified by:
getSession in interface org.apache.catalina.Session
Overrides:
getSession in class org.apache.catalina.session.StandardSession

getAttribute

public Object getAttribute(String name)
Return the object bound with the specified name in this session, or null if no object is bound with that name.

Specified by:
getAttribute in interface javax.servlet.http.HttpSession
Overrides:
getAttribute in class org.apache.catalina.session.StandardSession
Parameters:
name - Name of the attribute to be returned
Throws:
IllegalStateException - if this method is called on an invalidated session

getLocalAttribute

public Object getLocalAttribute(String name)
Get HazelAttribute directly


setAttribute

public void setAttribute(String name,
                         Object value,
                         boolean notify)
Bind an object to this session, using the specified name. If an object of the same name is already bound to this session, the object is replaced.

After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueBound() on the object.

Overrides:
setAttribute in class org.apache.catalina.session.StandardSession
Parameters:
name - Name to which the object is bound, cannot be null
value - Object to be bound, cannot be null
notify - whether to notify session listeners
Throws:
IllegalArgumentException - if an attempt is made to add a non-serializable object in an environment marked distributable.
IllegalStateException - if this method is called on an invalidated session

removeAttributeInternal

protected void removeAttributeInternal(String name,
                                       boolean notify)
Remove the object bound with the specified name from this session. If the session does not have an object bound with this name, this method does nothing.

After this method executes, and if the object implements HttpSessionBindingListener, the container calls valueUnbound() on the object.

Overrides:
removeAttributeInternal in class org.apache.catalina.session.StandardSession
Parameters:
name - Name of the object to remove from this session.
notify - Should we notify interested listeners that this attribute is being removed?

removeAttributeHard

protected void removeAttributeHard(String name,
                                   boolean notify)

notifyRemove

protected void notifyRemove(String name,
                            Object value,
                            boolean notify)

activate

public void activate()
Perform internal processing required to activate this session.

Overrides:
activate in class org.apache.catalina.session.StandardSession

passivate

public void passivate()
Perform the internal processing required to passivate this session.

Overrides:
passivate in class org.apache.catalina.session.StandardSession

readObject

protected void readObject(ObjectInputStream stream)
                   throws ClassNotFoundException,
                          IOException
Read a serialized version of this session object from the specified object input stream.

IMPLEMENTATION NOTE: The reference to the owning Manager is not restored by this method, and must be set explicitly.

Overrides:
readObject in class org.apache.catalina.session.StandardSession
Parameters:
stream - The input stream to read from
Throws:
ClassNotFoundException - if an unknown class is specified
IOException - if an input/output error occurs

writeObject

protected void writeObject(ObjectOutputStream stream)
                    throws IOException
Write a serialized version of this session object to the specified object output stream.

IMPLEMENTATION NOTE: The owning Manager will not be stored in the serialized representation of this Session. After calling readObject(), you must set the associated Manager explicitly.

IMPLEMENTATION NOTE: Any attribute that is not Serializable will be unbound from the session, with appropriate actions if it implements HttpSessionBindingListener. If you do not want any such attributes, be sure the distributable property of the associated Manager is set to true.

Overrides:
writeObject in class org.apache.catalina.session.StandardSession
Parameters:
stream - The output stream to write to
Throws:
IOException - if an input/output error occurs

setId

public void setId(String id)
Set the session identifier for this session.

Specified by:
setId in interface org.apache.catalina.Session
Overrides:
setId in class org.apache.catalina.session.StandardSession
Parameters:
id - The new session identifier

expire

public void expire(boolean notify)
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.

Overrides:
expire in class org.apache.catalina.session.StandardSession
Parameters:
notify - Should we notify listeners about the demise of this session?

keys

protected String[] keys()
Return the names of all currently defined session attributes as an array of Strings. If there are no defined attributes, a zero-length array is returned.

Overrides:
keys in class org.apache.catalina.session.StandardSession

getAttributeNames

public Enumeration getAttributeNames()
Return an Enumeration of String objects containing the names of the objects bound to this session.

Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession
Overrides:
getAttributeNames in class org.apache.catalina.session.StandardSession
Throws:
IllegalStateException - if this method is called on an invalidated session


Copyright © 2012 Hazel Bilisim Ltd.. All Rights Reserved.