public class ServletHttpSession extends Object implements HttpSession, HttpSessionAdministration
Constructor and Description |
---|
ServletHttpSession(javax.servlet.http.HttpSession session,
Clock clock,
String tokenName)
Initiate.
|
Modifier and Type | Method and Description |
---|---|
Serializable |
getAttribute(String name)
Obtains the
Object that is bound to the name for this
HttpSession . |
Iterator<String> |
getAttributeNames()
|
long |
getCreationTime()
Obtains the time this
HttpSession was created. |
long |
getExpireTime()
Obtains the time this
HttpSession will be expired should it be
idle. |
HttpSessionAdministration |
getHttpSessionAdministration()
Obtains the
HttpSessionAdministration to administer this
HttpSession . |
String |
getSessionId()
Obtains the session Id.
|
String |
getTokenName()
Obtains the token name.
|
void |
invalidate(boolean isRequireNewSession)
Triggers invalidating the
HttpSession . |
boolean |
isNew()
Indicates if this is a new
HttpSession . |
boolean |
isOperationComplete()
Indicates if the invalidate or store operation are complete.
|
void |
removeAttribute(String name)
Removes the bound
Object by the name from this
HttpSession . |
void |
setAttribute(String name,
Serializable object)
Binds the
Object to the name within this HttpSession . |
void |
setExpireTime(long expireTime)
Specifies the time this
HttpSession will expire if idle. |
void |
store()
Triggers storing the
HttpSession . |
public String getSessionId() throws InvalidatedHttpSessionException
HttpSession
getSessionId
in interface HttpSession
InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public String getTokenName()
HttpSession
Obtains the token name.
This is the name of the cookie or parameter that contains the session Id.
getTokenName
in interface HttpSession
public boolean isNew() throws InvalidatedHttpSessionException
HttpSession
HttpSession
.isNew
in interface HttpSession
true
if this is a new HttpSession
.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public long getCreationTime() throws InvalidatedHttpSessionException
HttpSession
HttpSession
was created.getCreationTime
in interface HttpSession
HttpSession
was created.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public long getExpireTime() throws InvalidatedHttpSessionException
HttpSession
HttpSession
will be expired should it be
idle.getExpireTime
in interface HttpSession
HttpSession
will be expired.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public void setExpireTime(long expireTime) throws StoringHttpSessionException, InvalidatedHttpSessionException
HttpSession
Specifies the time this HttpSession
will expire if idle.
The HttpSessionStore
may increment this time on further requests
to keep the HttpSession
active over a long conversation.
setExpireTime
in interface HttpSession
expireTime
- Time to expire this HttpSession
.StoringHttpSessionException
- Indicating the HttpSession
is currently being stored
and can not be altered.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public Serializable getAttribute(String name) throws InvalidatedHttpSessionException
HttpSession
Object
that is bound to the name for this
HttpSession
.getAttribute
in interface HttpSession
name
- Name.Object
bound to the name or null
if no
Object
bound by the name.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public Iterator<String> getAttributeNames() throws InvalidatedHttpSessionException
HttpSession
getAttributeNames
in interface HttpSession
Iterator
to the names of the bound Object
instances.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public void setAttribute(String name, Serializable object) throws StoringHttpSessionException, InvalidatedHttpSessionException
HttpSession
Object
to the name within this HttpSession
.setAttribute
in interface HttpSession
name
- Name.object
- Object
. Must be Serializable
as the attributes
of this HttpSession
may be serialised to larger,
cheaper memory stores or for clustered HttpSession
management sent over the network.StoringHttpSessionException
- Indicating the HttpSession
is currently being stored
and can not be altered.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public void removeAttribute(String name) throws StoringHttpSessionException, InvalidatedHttpSessionException
HttpSession
Object
by the name from this
HttpSession
.removeAttribute
in interface HttpSession
name
- Name of bound Object
to remove.StoringHttpSessionException
- Indicating the HttpSession
is currently being stored
and can not be altered.InvalidatedHttpSessionException
- Indicating the HttpSession
is invalidated.public HttpSessionAdministration getHttpSessionAdministration()
HttpSession
HttpSessionAdministration
to administer this
HttpSession
.getHttpSessionAdministration
in interface HttpSession
HttpSessionAdministration
to administer this
HttpSession
.public void invalidate(boolean isRequireNewSession) throws Throwable
HttpSessionAdministration
HttpSession
.invalidate
in interface HttpSessionAdministration
isRequireNewSession
- true
to have a new HttpSession
created.Throwable
- If immediate failure in invalidating the HttpSession
.public boolean isOperationComplete() throws Throwable
HttpSessionAdministration
Indicates if the invalidate or store operation are complete.
As is an AsynchronousManagedObject
, the next time a new
Task
is run the operation should be complete. This method enables
determining if completed immediately and there were no failures of the
operation.
isOperationComplete
in interface HttpSessionAdministration
true
if the invalidate or store operation is
complete.Throwable
- Possible failure in invalidating or storing the
HttpSession
.public void store() throws Throwable
HttpSessionAdministration
HttpSession
.store
in interface HttpSessionAdministration
Throwable
- If immediate failure in storing the HttpSession
.Copyright © 2005–2016. All rights reserved.