Package com.aspectran.core.adapter
Class BasicSessionAdapter
- java.lang.Object
-
- com.aspectran.core.adapter.AbstractSessionAdapter
-
- com.aspectran.core.adapter.BasicSessionAdapter
-
- All Implemented Interfaces:
SessionAdapter
public class BasicSessionAdapter extends AbstractSessionAdapter
The Class BasicSessionAdapter.- Since:
- 2.3.0
-
-
Constructor Summary
Constructors Constructor Description BasicSessionAdapter(SessionAgent agent)Instantiates a new BasicSessionAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAdaptee()Returns the adaptee object to provide session information.<T> TgetAttribute(java.lang.String name)Returns the value of the named attribute as a given type, ornullif 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.longgetCreationTime()Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.java.lang.StringgetId()Returns a string containing the unique identifier assigned to this session.longgetLastAccessedTime()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.intgetMaxInactiveInterval()Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.SessionAgentgetSessionAgent()SessionScopegetSessionScope()Gets the session scope.voidinvalidate()Invalidates this session then unbinds any objects bound to it.booleanisNew()voidremoveAttribute(java.lang.String name)Removes the object bound with the specified name from this session.voidsessionAccess()voidsessionComplete()voidsetAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this session.voidsetMaxInactiveInterval(int secs)-
Methods inherited from class com.aspectran.core.adapter.AbstractSessionAdapter
toString
-
-
-
-
Constructor Detail
-
BasicSessionAdapter
public BasicSessionAdapter(SessionAgent agent)
Instantiates a new BasicSessionAdapter.- Parameters:
agent- the session agent
-
-
Method Detail
-
getAdaptee
public <T> T getAdaptee()
Description copied from interface:SessionAdapterReturns the adaptee object to provide session information.- Specified by:
getAdapteein interfaceSessionAdapter- Overrides:
getAdapteein classAbstractSessionAdapter- Type Parameters:
T- the type of the adaptee object- Returns:
- the adaptee object
-
getId
public java.lang.String getId()
Description copied from interface:SessionAdapterReturns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.- Returns:
- a string specifying the identifier assigned to this session
-
isNew
public boolean isNew()
-
getCreationTime
public long getCreationTime()
Description copied from interface:SessionAdapterReturns 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
-
getLastAccessedTime
public long getLastAccessedTime()
Description copied from interface:SessionAdapterReturns 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
-
getMaxInactiveInterval
public int getMaxInactiveInterval()
Description copied from interface:SessionAdapterReturns 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 thesetMaxInactiveIntervalmethod. A negative time indicates the session should never timeout.- Returns:
- an integer specifying the number of seconds this session remains open between client requests
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int secs)
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
Description copied from interface:SessionAdapterReturns 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
-
getAttribute
public <T> T getAttribute(java.lang.String name)
Description copied from interface:SessionAdapterReturns the value of the named attribute as a given type, ornullif no attribute of the given name exists.- Type Parameters:
T- the generic type- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Description copied from interface:SessionAdapterStores an attribute in this session.- Parameters:
name- specifying the name of the attributevalue- theObjectto be stored
-
removeAttribute
public void removeAttribute(java.lang.String name)
Description copied from interface:SessionAdapterRemoves 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
public void invalidate()
Description copied from interface:SessionAdapterInvalidates this session then unbinds any objects bound to it.
-
getSessionScope
public SessionScope getSessionScope()
Description copied from interface:SessionAdapterGets the session scope.- Returns:
- the session scope
-
getSessionAgent
public SessionAgent getSessionAgent()
-
sessionAccess
public void sessionAccess()
-
sessionComplete
public void sessionComplete()
-
-