Package net.officefloor.web.session
Interface HttpSession
-
public interface HttpSession
HTTP session.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.Serializable
getAttribute(java.lang.String name)
Obtains theObject
that is bound to the name for thisHttpSession
.java.util.Iterator<java.lang.String>
getAttributeNames()
Obtains anIterator
to the names of the boundObject
instances.java.time.Instant
getCreationTime()
Obtains the time thisHttpSession
was created.java.time.Instant
getExpireTime()
Obtains the time thisHttpSession
will be expired should it be idle.HttpSessionAdministration
getHttpSessionAdministration()
Obtains theHttpSessionAdministration
to administer thisHttpSession
.java.lang.String
getSessionId()
Obtains the session Id.java.lang.String
getTokenName()
Obtains the token name.boolean
isNew()
Indicates if this is a newHttpSession
.void
removeAttribute(java.lang.String name)
Removes the boundObject
by the name from thisHttpSession
.void
setAttribute(java.lang.String name, java.io.Serializable object)
Binds theObject
to the name within thisHttpSession
.void
setExpireTime(java.time.Instant expireTime)
Specifies the time thisHttpSession
will expire if idle.
-
-
-
Method Detail
-
getSessionId
java.lang.String getSessionId() throws InvalidatedSessionHttpException
Obtains the session Id.- Returns:
- Session Id.
- Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getTokenName
java.lang.String getTokenName()
Obtains the token name.
This is the name of the
HttpRequestCookie
that contains the session Id.- Returns:
- Token name.
-
isNew
boolean isNew() throws InvalidatedSessionHttpException
Indicates if this is a newHttpSession
.- Returns:
true
if this is a newHttpSession
.- Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getCreationTime
java.time.Instant getCreationTime() throws InvalidatedSessionHttpException
Obtains the time thisHttpSession
was created.- Returns:
- Time this
HttpSession
was created. - Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getExpireTime
java.time.Instant getExpireTime() throws InvalidatedSessionHttpException
Obtains the time thisHttpSession
will be expired should it be idle.- Returns:
- Time this
HttpSession
will be expired. - Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
setExpireTime
void setExpireTime(java.time.Instant expireTime) throws StoringSessionHttpException, InvalidatedSessionHttpException
Specifies the time this
HttpSession
will expire if idle.The
HttpSessionStore
may increment this time on further requests to keep theHttpSession
active over a long conversation.- Parameters:
expireTime
- Time to expire thisHttpSession
.- Throws:
StoringSessionHttpException
- Indicating theHttpSession
is currently being stored and can not be altered.InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getAttribute
java.io.Serializable getAttribute(java.lang.String name) throws InvalidatedSessionHttpException
Obtains theObject
that is bound to the name for thisHttpSession
.- Parameters:
name
- Name.- Returns:
Object
bound to the name ornull
if noObject
bound by the name.- Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getAttributeNames
java.util.Iterator<java.lang.String> getAttributeNames() throws InvalidatedSessionHttpException
Obtains anIterator
to the names of the boundObject
instances.- Returns:
Iterator
to the names of the boundObject
instances.- Throws:
InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
setAttribute
void setAttribute(java.lang.String name, java.io.Serializable object) throws StoringSessionHttpException, InvalidatedSessionHttpException
Binds theObject
to the name within thisHttpSession
.- Parameters:
name
- Name.object
-Object
. Must beSerializable
as the attributes of thisHttpSession
may be serialised to larger, cheaper memory stores or for clusteredHttpSession
management sent over the network.- Throws:
StoringSessionHttpException
- Indicating theHttpSession
is currently being stored and can not be altered.InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
removeAttribute
void removeAttribute(java.lang.String name) throws StoringSessionHttpException, InvalidatedSessionHttpException
Removes the boundObject
by the name from thisHttpSession
.- Parameters:
name
- Name of boundObject
to remove.- Throws:
StoringSessionHttpException
- Indicating theHttpSession
is currently being stored and can not be altered.InvalidatedSessionHttpException
- Indicating theHttpSession
is invalidated.
-
getHttpSessionAdministration
HttpSessionAdministration getHttpSessionAdministration()
Obtains theHttpSessionAdministration
to administer thisHttpSession
.- Returns:
HttpSessionAdministration
to administer thisHttpSession
.
-
-