Package com.aspectran.core.adapter
Interface SessionAdapter
-
- All Known Implementing Classes:
AbstractSessionAdapter
,AspectranSessionAdapter
,DaemonSessionAdapter
,DefaultSessionAdapter
,HttpSessionAdapter
,ShellSessionAdapter
,TowSessionAdapter
public interface SessionAdapter
The Interface SessionAdapter.- Since:
- 2011. 3. 13.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getAdaptee()
Returns the adaptee object to provide session information.<T> T
getAttribute(java.lang.String name)
Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.java.util.Enumeration<java.lang.String>
getAttributeNames()
Returns an Enumeration of String objects containing the names of all the objects bound to this session.long
getCreationTime()
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.java.lang.String
getId()
Returns a string containing the unique identifier assigned to this 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 received the request.int
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the session manager 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 a new session was created for this request.SessionScope
newSessionScope()
void
removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this session.void
setAttribute(java.lang.String name, java.lang.Object value)
Stores an attribute in this session.void
setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before invalidating the session.
-
-
-
Method Detail
-
getAdaptee
<T> T getAdaptee()
Returns the adaptee object to provide session information.- Type Parameters:
T
- the type of the adaptee object- Returns:
- the adaptee object
-
newSessionScope
SessionScope newSessionScope()
-
getId
java.lang.String getId()
Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the session manager and is implementation dependent.- Returns:
- a string specifying the identifier assigned to this session
- Since:
- 1.5.0
-
getCreationTime
long getCreationTime()
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.- Returns:
- a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT
- Since:
- 1.5.0
-
getLastAccessedTime
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 received the request. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.- Returns:
- a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT
- Since:
- 1.5.0
-
setMaxInactiveInterval
void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before invalidating the session. A negative time indicates the session should never timeout.- Parameters:
interval
- an integer specifying the number of seconds
-
getMaxInactiveInterval
int getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the session manager will keep this session open between client accesses. After this interval, the session manager will invalidate the session. The maximum time interval can be set with thesetMaxInactiveInterval
method. A negative time indicates the session should never timeout.- Returns:
- an integer specifying the number of seconds this session remains open between client requests
- Since:
- 1.5.0
-
getAttributeNames
java.util.Enumeration<java.lang.String> getAttributeNames()
Returns an Enumeration of String objects containing the names of all the objects bound to this session.- Returns:
- an Enumeration of String objects specifying the names of all the objects bound to this session
- Since:
- 1.5.0
-
getAttribute
<T> T getAttribute(java.lang.String name)
Returns the value of the named attribute as a given type, ornull
if no attribute of the given name exists.- Type Parameters:
T
- the generic type- Parameters:
name
- aString
specifying the name of the attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value)
Stores an attribute in this session.- Parameters:
name
- specifying the name of the attributevalue
- theObject
to be stored
-
removeAttribute
void removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.- Parameters:
name
- the name of the object to remove from this session
-
invalidate
void invalidate()
Invalidates this session then unbinds any objects bound to it.
-
isNew
boolean isNew()
Returns true if a new session was created for this request.- Returns:
- true if the server has created a session, but the client has not yet joined
-
-