Top Description Inners Fields Methods
org.eclipse.jetty.server

public Interface Session

extends Attributes
Imports
org.eclipse.jetty.util.Attributes

The interface to a generic session associated with a request. This interface may be used directly, or it may be wrapped by an API specific representation of a session. Such wrappers must implement the API sub interface.

Depending on the implementation the attribute values may be stored locally in memory or in a remote database. The instances of the attribute values may be different to those passed to setAttribute(String, Object) or to those returned in previous getAttribute(String) calls.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Session.API

An API wrapper of the core session.

public static interface
Session.LifeCycleListener

Listener interface that if implemented by a value of an attribute of an enclosing Context at start, will be notified of session lifecycle events.

public static interface
Session.ValueListener

Listener interface that if implemented by a session attribute value, will be notified of session value events.

Field Summary

Inherited from org.eclipse.jetty.util.Attributes:
NULL

Method Summary

Modifier and TypeMethod and Description
public String
encodeURI(Request request, String uri, boolean cookiesInUse)

public <
The type of the API wrapper.
T extends Session.API
>
T
getApi()

Returns: An API wrapper of this session or null if there is none.

public String
getExtendedId()

Returns: The session identifier as returned by getId() extended with additional routing information.

public String
getId()

Returns: A identifier for the session.

public long
getLastAccessedTime()

Returns: the time, as represented by System#currentTimeMillis(), that the session was last accessed by a request.

public int
getMaxInactiveInterval()

Returns: The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.

public static Session

Returns:

The associated Session.
getSession
(Object
The API wrapper of the session
session
)

Get the session associated with an API session wrapper.

public void
invalidate()

Invalidate this session in the current context and all sessions of the same identity with associated contexts.

public boolean
isNew()

Returns: true if the session has been newly created within the scope of the current request.

public boolean
isValid()

Returns: true if the session is has not been invalidated nor expired due to inactivity.

public void
renewId(Request
The request from which the session was obtained.
request
,
Response
The response which may be updated with the new session identity.
response
)

Renew the identity of the session.

public void
setMaxInactiveInterval(int
The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.
secs
)

Inherited from org.eclipse.jetty.util.Attributes:
asAttributeMapclearAttributesequalsequalsgetAttributegetAttributeNameSethashCodehashCoderemoveAttributesetAttributeunwrapunwrap

Method Detail

encodeURIback to summary
public String encodeURI(Request request, String uri, boolean cookiesInUse)
getApiback to summary
public <T extends Session.API> T getApi()
Parameters
<T>
The type of the API wrapper.
Returns:T

An API wrapper of this session or null if there is none.

Annotations
@SuppressWarnings:unchecked
getExtendedIdback to summary
public String getExtendedId()
Returns:String

The session identifier as returned by getId() extended with additional routing information. The additional information does not form part of the identity, but may be used by implementations and associated infrastructure to help route request for the same session to the same server.

getIdback to summary
public String getId()
Returns:String

A identifier for the session. Depending on the implementation may be unique within the context, the server, the JVM or a cluster.

See Also
getExtendedId()
getLastAccessedTimeback to summary
public long getLastAccessedTime()
Returns:long

the time, as represented by System#currentTimeMillis(), that the session was last accessed by a request.

getMaxInactiveIntervalback to summary
public int getMaxInactiveInterval()
Returns:int

The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.

getSessionback to summary
public static Session getSession(Object session)

Get the session associated with an API session wrapper.

Parameters
session:Object

The API wrapper of the session

Returns:Session

The associated Session.

invalidateback to summary
public void invalidate()

Invalidate this session in the current context and all sessions of the same identity with associated contexts.

isNewback to summary
public boolean isNew() throws IllegalStateException
Returns:boolean

true if the session has been newly created within the scope of the current request.

isValidback to summary
public boolean isValid()
Returns:boolean

true if the session is has not been invalidated nor expired due to inactivity.

renewIdback to summary
public void renewId(Request request, Response response)

Renew the identity of the session. Typically, this is done after a change of authentication or confidentiality.

Parameters
request:Request

The request from which the session was obtained.

response:Response

The response which may be updated with the new session identity.

setMaxInactiveIntervalback to summary
public void setMaxInactiveInterval(int secs)
Parameters
secs:int

The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.

org.eclipse.jetty.server back to summary

public Interface Session.API


An API wrapper of the core session.

API wrappers of the Session must implement this interface and return the Session that they wrap.

Method Summary

Modifier and TypeMethod and Description
public Session

Method Detail

getSessionback to summary
public Session getSession()
org.eclipse.jetty.server back to summary

public Interface Session.LifeCycleListener


Listener interface that if implemented by a value of an attribute of an enclosing Context at start, will be notified of session lifecycle events.

Method Summary

Modifier and TypeMethod and Description
public default void
public default void
public default void

Method Detail

onSessionCreatedback to summary
public default void onSessionCreated(Session session)
onSessionDestroyedback to summary
public default void onSessionDestroyed(Session session)
onSessionIdChangedback to summary
public default void onSessionIdChanged(Session session, String oldId)
org.eclipse.jetty.server back to summary

public Interface Session.ValueListener


Listener interface that if implemented by a session attribute value, will be notified of session value events.

Method Summary

Modifier and TypeMethod and Description
public default void
public default void
onSessionAttributeUpdate(Session session, String name, Object oldValue, Object newValue)

public default void

Method Detail

onSessionActivationback to summary
public default void onSessionActivation(Session session)
onSessionAttributeUpdateback to summary
public default void onSessionAttributeUpdate(Session session, String name, Object oldValue, Object newValue)
onSessionPassivationback to summary
public default void onSessionPassivation(Session session)