Package net.officefloor.web.session
Interface HttpSession
public interface HttpSession
HTTP session.
- Author:
- Daniel Sagenschneider
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Obtains theObjectthat is bound to the name for thisHttpSession.Obtains the time thisHttpSessionwas created.Obtains the time thisHttpSessionwill be expired should it be idle.Obtains theHttpSessionAdministrationto administer thisHttpSession.Obtains the session Id.Obtains the token name.booleanisNew()Indicates if this is a newHttpSession.voidremoveAttribute(String name) Removes the boundObjectby the name from thisHttpSession.voidsetAttribute(String name, Serializable object) Binds theObjectto the name within thisHttpSession.voidsetExpireTime(Instant expireTime) Specifies the time thisHttpSessionwill expire if idle.
-
Method Details
-
getSessionId
Obtains the session Id.- Returns:
- Session Id.
- Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getTokenName
String getTokenName()Obtains the token name.
This is the name of the
HttpRequestCookiethat contains the session Id.- Returns:
- Token name.
-
isNew
Indicates if this is a newHttpSession.- Returns:
trueif this is a newHttpSession.- Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getCreationTime
Obtains the time thisHttpSessionwas created.- Returns:
- Time this
HttpSessionwas created. - Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getExpireTime
Obtains the time thisHttpSessionwill be expired should it be idle.- Returns:
- Time this
HttpSessionwill be expired. - Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
setExpireTime
void setExpireTime(Instant expireTime) throws StoringSessionHttpException, InvalidatedSessionHttpException Specifies the time this
HttpSessionwill expire if idle.The
HttpSessionStoremay increment this time on further requests to keep theHttpSessionactive over a long conversation.- Parameters:
expireTime- Time to expire thisHttpSession.- Throws:
StoringSessionHttpException- Indicating theHttpSessionis currently being stored and can not be altered.InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getAttribute
Obtains theObjectthat is bound to the name for thisHttpSession.- Parameters:
name- Name.- Returns:
Objectbound to the name ornullif noObjectbound by the name.- Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getAttributeNames
- Returns:
Iteratorto the names of the boundObjectinstances.- Throws:
InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
setAttribute
void setAttribute(String name, Serializable object) throws StoringSessionHttpException, InvalidatedSessionHttpException Binds theObjectto the name within thisHttpSession.- Parameters:
name- Name.object-Object. Must beSerializableas the attributes of thisHttpSessionmay be serialised to larger, cheaper memory stores or for clusteredHttpSessionmanagement sent over the network.- Throws:
StoringSessionHttpException- Indicating theHttpSessionis currently being stored and can not be altered.InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
removeAttribute
void removeAttribute(String name) throws StoringSessionHttpException, InvalidatedSessionHttpException Removes the boundObjectby the name from thisHttpSession.- Parameters:
name- Name of boundObjectto remove.- Throws:
StoringSessionHttpException- Indicating theHttpSessionis currently being stored and can not be altered.InvalidatedSessionHttpException- Indicating theHttpSessionis invalidated.
-
getHttpSessionAdministration
HttpSessionAdministration getHttpSessionAdministration()Obtains theHttpSessionAdministrationto administer thisHttpSession.- Returns:
HttpSessionAdministrationto administer thisHttpSession.
-