org.apache.tapestry.web
Class ServletWebSession

java.lang.Object
  extended by org.apache.tapestry.web.ServletWebSession
All Implemented Interfaces:
Describable, AttributeHolder, WebSession

public class ServletWebSession
extends Object
implements WebSession

Adapts HttpSession  as WebSession.

Since:
4.0
Author:
Howard M. Lewis Ship

Constructor Summary
ServletWebSession(HttpSession session)
           
 
Method Summary
 void describeTo(DescriptionReceiver receiver)
          Invoked to have the receiver describe itself (largely in terms of properties and values).
 Object getAttribute(String name)
          Returns the named object, or null if no attribute has been stored with the given name.
 List getAttributeNames()
          Returns a list of all known attributes in ascending alphabetical order.
 long getCreationTime()
          Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
 String getId()
          Returns a unique string identifier used to identify the session.
 long getLastAccessedTime()
          Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container recieved the request.
 int getMaxInactiveInterval()
          Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.
 void invalidate()
          Invalidates this session then unbinds any objects bound to it.
 boolean isNew()
          Returns true if the client does not yet know about the session or if the client chooses not to join the session.
 void setAttribute(String name, Object attribute)
          Updates the attribute, replacing (or removing) its value.
 void setMaxInactiveInterval(int interval)
          Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletWebSession

public ServletWebSession(HttpSession session)
Method Detail

describeTo

public void describeTo(DescriptionReceiver receiver)
Description copied from interface: Describable
Invoked to have the receiver describe itself (largely in terms of properties and values). If the caller does not invoke any methods on the receiver, then the a default description of the caller will be used (based on toString().

Specified by:
describeTo in interface Describable

getAttributeNames

public List getAttributeNames()
Description copied from interface: AttributeHolder
Returns a list of all known attributes in ascending alphabetical order. May be empty (but won't be null).

Specified by:
getAttributeNames in interface AttributeHolder

getAttribute

public Object getAttribute(String name)
Description copied from interface: AttributeHolder
Returns the named object, or null if no attribute has been stored with the given name.

Specified by:
getAttribute in interface AttributeHolder

setAttribute

public void setAttribute(String name,
                         Object attribute)
Description copied from interface: AttributeHolder
Updates the attribute, replacing (or removing) its value. For certain implementations, the attribute may need to be serializable (for example, a WebSession  attribute in a clustered application).

Specified by:
setAttribute in interface AttributeHolder
Parameters:
name - the name of the attribute to update
attribute - the new value for the attribute, or null to delete the attribute entirely.

getId

public String getId()
Description copied from interface: WebSession
Returns a unique string identifier used to identify the session. This value is provided by the container, and is typically incorporated into URLs, or stored as a HTTP cookie.

Specified by:
getId in interface WebSession
See Also:
.

isNew

public boolean isNew()
Description copied from interface: WebSession
Returns true if the client does not yet know about the session or if the client chooses not to join the session.

Specified by:
isNew in interface WebSession

invalidate

public void invalidate()
Description copied from interface: WebSession
Invalidates this session then unbinds any objects bound to it.

Specified by:
invalidate in interface WebSession

getCreationTime

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

Specified by:
getCreationTime in interface WebSession
Returns:
a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT

getLastAccessedTime

public long getLastAccessedTime()
Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container recieved the request.

Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

Specified by:
getLastAccessedTime in interface WebSession
Returns:
a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT

getMaxInactiveInterval

public int getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.

Specified by:
getMaxInactiveInterval in interface WebSession
Returns:
an integer specifying the number of seconds this session remains open between client requests

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.

Specified by:
setMaxInactiveInterval in interface WebSession
Parameters:
interval - - An integer specifying the number of seconds


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.