org.apache.tomcat.facade
Class HttpSessionFacade

java.lang.Object
  extended byorg.apache.tomcat.facade.HttpSessionFacade
All Implemented Interfaces:
javax.servlet.http.HttpSession

public final class HttpSessionFacade
extends java.lang.Object
implements javax.servlet.http.HttpSession

Facade for http session. Used to prevent servlets to access internal tomcat objects. This is a "special" facade - since session management is (more or less) orthogonal to request processing, it is indpendent of tomcat architecture. It will provide a HttpSession implementation ( but it's not guaranteed in any way it is "safe" ), and HttpSessionFacade will act as a "guard" to make sure only servlet API public methods are exposed. Another thing to note is that this object will be recycled and will allways be set in a request. The "real" session object will determine if the request is part of a session.

Author:
James Duncan Davidson [duncan@eng.sun.com], Jason Hunter [jch@eng.sun.com], James Todd [gonzo@eng.sun.com], costin@eng.sun.com

Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
          Return an Enumeration of String objects containing the names of the objects bound to this session.
 long getCreationTime()
          Return the time when this session was created, in milliseconds since midnight, January 1, 1970 GMT.
 java.lang.String getId()
           
 long getLastAccessedTime()
           
 int getMaxInactiveInterval()
           
 javax.servlet.http.HttpSessionContext getSessionContext()
          Deprecated.  
 java.lang.Object getValue(java.lang.String name)
          Deprecated.  
 java.lang.String[] getValueNames()
          Deprecated.  
 void invalidate()
          Invalidates this session and unbinds any objects bound to it.
 boolean isNew()
          Return true if the client does not yet know about the session, or if the client chooses not to join the session.
 void putValue(java.lang.String name, java.lang.Object value)
          Deprecated.  
 void removeAttribute(java.lang.String name)
          Remove the object bound with the specified name from this session.
 void removeValue(java.lang.String name)
          Deprecated.  
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setMaxInactiveInterval(int interval)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getId

public java.lang.String getId()
Specified by:
getId in interface javax.servlet.http.HttpSession

getCreationTime

public long getCreationTime()
Return the time when this session was created, in milliseconds since midnight, January 1, 1970 GMT.

Specified by:
getCreationTime in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session

getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Deprecated.  

We return our own "disabled" SessionContext - regardless of what the real session returns.

Specified by:
getSessionContext in interface javax.servlet.http.HttpSession

getLastAccessedTime

public long getLastAccessedTime()
Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession

invalidate

public void invalidate()
Invalidates this session and unbinds any objects bound to it.

Specified by:
invalidate in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session

isNew

public boolean isNew()
Return true if the client does not yet know about the session, or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client has disabled the use of cookies, then a session would be new on each request.

Specified by:
isNew in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session

putValue

public void putValue(java.lang.String name,
                     java.lang.Object value)
Deprecated.  

Specified by:
putValue in interface javax.servlet.http.HttpSession

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface javax.servlet.http.HttpSession

getValue

public java.lang.Object getValue(java.lang.String name)
Deprecated.  

Specified by:
getValue in interface javax.servlet.http.HttpSession

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface javax.servlet.http.HttpSession

getValueNames

public java.lang.String[] getValueNames()
Deprecated.  

Specified by:
getValueNames in interface javax.servlet.http.HttpSession

getAttributeNames

public java.util.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
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session

removeValue

public void removeValue(java.lang.String name)
Deprecated.  

Specified by:
removeValue in interface javax.servlet.http.HttpSession

removeAttribute

public void removeAttribute(java.lang.String name)
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.

Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - Name of the object to remove from this session.
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface javax.servlet.http.HttpSession


Copyright © 2001 Apache Software Foundation. All Rights Reserved.