electric.servlet.sessions
Class HTTPSession

java.lang.Object
  extended byelectric.servlet.sessions.HTTPSession
All Implemented Interfaces:
javax.servlet.http.HttpSession, ISession

public final class HTTPSession
extends java.lang.Object
implements javax.servlet.http.HttpSession, ISession

HTTPSession is an implementation of the standard HttpSession interface.

Author:
webMethods

Constructor Summary
HTTPSession(HTTPContext context)
          Construct an HTTPSession associated with the specified context.
 
Method Summary
 void accessed()
          Set the last accessed time to the current time.
 boolean expired()
           
 java.lang.Object getAttribute(java.lang.String name)
          Return the attribute associated with the specified name.
 java.util.Enumeration getAttributeNames()
          Return an enumeration over all the attribute names.
 long getCreationTime()
          Return my creation time as milliseconds since midnight January 1, 1970 GMT
static int getDefaultTimeout()
          Return the default maximum inactive interval, in seconds.
 java.lang.String getId()
          Return my id.
 long getLastAccessedTime()
          Return the last accessed time.
 int getMaxInactiveInterval()
          Return the maximum number of seconds that I can remain inactive before being invalidated.
 javax.servlet.ServletContext getServletContext()
           
 javax.servlet.http.HttpSessionContext getSessionContext()
          Deprecated.  
 int getTimeout()
           
 java.lang.Object getValue(java.lang.String name)
          Deprecated.  
 java.lang.String[] getValueNames()
          Deprecated.  
 void invalidate()
          Invalidates this session then unbinds any objects bound to it.
 boolean isNew()
          Return true if I have not been accessed yet.
 boolean isValid()
          Check if the session is still valid.
 void putValue(java.lang.String name, java.lang.Object value)
          Deprecated.  
 void removeAttribute(java.lang.String name)
          Remove the attribute with the specified name.
 void removeValue(java.lang.String name)
          Deprecated.  
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set an attribute with the specified name and value.
static void setDefaultTimeout(int seconds)
          Set the default maximum inactive interval, in seconds
 void setMaxInactiveInterval(int interval)
          Set the maximum number of seconds that I can remain inactive before being invalidated.
 void setTimeout(int interval)
          Set the maximum number of seconds that I can remain inactive before being invalidated.
 java.lang.String toString()
          Return a description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTTPSession

public HTTPSession(HTTPContext context)
Construct an HTTPSession associated with the specified context.

Parameters:
context - The context.
Method Detail

toString

public java.lang.String toString()
Return a description.


getId

public java.lang.String getId()
Return my id.

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

getCreationTime

public long getCreationTime()
                     throws java.lang.IllegalStateException
Return my creation time as milliseconds since midnight January 1, 1970 GMT

Specified by:
getCreationTime in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

setTimeout

public void setTimeout(int interval)
Description copied from interface: ISession
Set the maximum number of seconds that I can remain inactive before being invalidated.

Specified by:
setTimeout in interface ISession
Parameters:
interval -

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Set the maximum number of seconds that I can remain inactive before being invalidated.

Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession
Parameters:
interval - The time interval in seconds.

getTimeout

public int getTimeout()
Specified by:
getTimeout in interface ISession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Return the maximum number of seconds that I can remain inactive before being invalidated.

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

isNew

public boolean isNew()
              throws java.lang.IllegalStateException
Return true if I have not been accessed yet.

Specified by:
isNew in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

getLastAccessedTime

public long getLastAccessedTime()
Return the last accessed time.

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

accessed

public void accessed()
Set the last accessed time to the current time.

Specified by:
accessed in interface ISession

expired

public boolean expired()
Specified by:
expired in interface ISession

setDefaultTimeout

public static void setDefaultTimeout(int seconds)
Set the default maximum inactive interval, in seconds

Parameters:
seconds - The new maximum.

getDefaultTimeout

public static int getDefaultTimeout()
Return the default maximum inactive interval, in seconds.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalStateException
Return the attribute associated with the specified name.

Specified by:
getAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The name.
Throws:
java.lang.IllegalStateException - If the session is invalidated.

getAttributeNames

public java.util.Enumeration getAttributeNames()
                                        throws java.lang.IllegalStateException
Return an enumeration over all the attribute names.

Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException - If the session is invalidated.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalStateException
Set an attribute with the specified name and value. If the value is an instance of HttpSessionBindingListener, send it a valueBound event. If the value passed in is null, this has the same effect as calling removeAttribute(). From javax.servlet.http.HttpSession.

Specified by:
setAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The attribute name.
value - The attribute value.
Throws:
java.lang.IllegalStateException - If the session is invalidated.

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws java.lang.IllegalStateException
Remove the attribute with the specified name. If the value is an instance of HttpSessionBindingListener, send it a valueUnbound event.

Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - The name.
Throws:
java.lang.IllegalStateException - If the session is invalidated.

getValue

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

Specified by:
getValue in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

putValue

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

Specified by:
putValue in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

removeValue

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

Specified by:
removeValue in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

getValueNames

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

Specified by:
getValueNames in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

invalidate

public void invalidate()
                throws java.lang.IllegalStateException
Invalidates this session then unbinds any objects bound to it. From javax.servlet.http.HttpSession.

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

isValid

public boolean isValid()
Check if the session is still valid. Sessions can become invalid after a timeout, or be invalidated explicitly using the invalidate method.

Returns:
true if the session is valud, false otherwise.

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.http.HttpSession

getSessionContext

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

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


copyright© 2001-2004 by webMethods All Rights Reserved.