Class SessionImpl
java.lang.Object
org.apache.tapestry5.http.internal.services.SessionImpl
- All Implemented Interfaces:
Session
- Direct Known Subclasses:
ClusteredSessionImpl
A thin wrapper around
HttpSession.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tapestry5.http.services.Session
Session.LockMode -
Constructor Summary
ConstructorsConstructorDescriptionSessionImpl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, SessionLock lock) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsAttribute(String name) Checks if the a value is stored in the session with the specified name.booleancontainsAttribute(String name, Session.LockMode lockMode) Checks if the a value is stored in the session with the specified name.getAttribute(String name) Returns the value previously stored in the session.getAttribute(String name, Session.LockMode lockMode) Returns the value previously stored in the session.Returns a list of the names of all attributes stored in the session.getAttributeNames(String prefix) Returns a list of the names of all attributes stored in the session whose name has the provided prefix.getAttributeNames(String prefix, Session.LockMode lockMode) Returns a list of the names of all attributes stored in the session whose name has the provided prefix.getAttributeNames(Session.LockMode lockMode) Returns a list of the names of all attributes stored in the session.intReturns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.voidInvalidates this session then unbinds any objects bound to it.booleanChecks to see if the session has been invalidated.voidRe-stores dirty objects back into the session.voidsetAttribute(String name, Object value) Sets the value of an attribute.voidsetMaxInactiveInterval(int seconds) Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
-
Constructor Details
-
SessionImpl
public SessionImpl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, SessionLock lock)
-
-
Method Details
-
getAttribute
Description copied from interface:SessionReturns the value previously stored in the session.By default, a
WRITElock is requested.- Specified by:
getAttributein interfaceSession- Parameters:
name- The name of the attribute
-
getAttribute
Description copied from interface:SessionReturns the value previously stored in the session.Uses the requested
Session.LockModeto acquire an appropriate lock.- Specified by:
getAttributein interfaceSession- Parameters:
name- The name of the attribute
-
getAttributeNames
Description copied from interface:SessionReturns a list of the names of all attributes stored in the session.The names are returned sorted alphabetically.
By default, a
READlock is requested.- Specified by:
getAttributeNamesin interfaceSession
-
getAttributeNames
Description copied from interface:SessionReturns a list of the names of all attributes stored in the session.Uses the requested
Session.LockModeto acquire an appropiate lock.- Specified by:
getAttributeNamesin interfaceSession- Parameters:
lockMode- The requested minimum lock mode. If null,READis used.- Returns:
- Alphabetically sorted list of all attributes
-
setAttribute
Description copied from interface:SessionSets the value of an attribute. If the value isnull, then the attribute is deleted.- Specified by:
setAttributein interfaceSession- Parameters:
name- The name of the attributevalue- The new value of the attribute;nulldeletes the attribute.
-
containsAttribute
Description copied from interface:SessionChecks if the a value is stored in the session with the specified name.By default, a
READlock is requested.- Specified by:
containsAttributein interfaceSession- Parameters:
name- The name of the attribute
-
containsAttribute
Description copied from interface:SessionChecks if the a value is stored in the session with the specified name.Uses the requested
Session.LockModeto acquire an appropriate lock.- Specified by:
containsAttributein interfaceSession- Parameters:
name- The name of the attribute
-
getAttributeNames
Description copied from interface:SessionReturns a list of the names of all attributes stored in the session whose name has the provided prefix.By default, a
READlock is requested.- Specified by:
getAttributeNamesin interfaceSession- Parameters:
prefix- The attribute prefix- Returns:
- Alphabetically sorted list of attributes matching the prefix
-
getAttributeNames
Description copied from interface:SessionReturns a list of the names of all attributes stored in the session whose name has the provided prefix.Uses the requested
Session.LockModeto acquire an appropriate lock.- Specified by:
getAttributeNamesin interfaceSession- Parameters:
prefix- The attribute prefix- Returns:
- Alphabetically sorted list of attributes matching the prefix
-
getMaxInactiveInterval
Description copied from interface:SessionReturns 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:
getMaxInactiveIntervalin interfaceSession
-
invalidate
Description copied from interface:SessionInvalidates this session then unbinds any objects bound to it.- Specified by:
invalidatein interfaceSession
-
isInvalidated
Description copied from interface:SessionChecks to see if the session has been invalidated. Note: since 5.3 this will also catch calls toHttpSession.invalidate().- Specified by:
isInvalidatedin interfaceSession
-
setMaxInactiveInterval
Description copied from interface:SessionSpecifies 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:
setMaxInactiveIntervalin interfaceSession
-
restoreDirtyObjects
Description copied from interface:SessionRe-stores dirty objects back into the session. This is necessary to support clustering, because (in most application servers) session objects are only broadcast around the cluster from setAttribute(). If a mutable session object is read and changed, those changes will be limited to a single server in the cluster, which can cause confusing application failures in the event of a failover. Does nothing if there are no changes, or the session has been invalidated.- Specified by:
restoreDirtyObjectsin interfaceSession- See Also:
-