public class SessionTracker extends Object implements SessionListener
A given HTTP request may be associated with more than one active session if it has been dispatched to one or more foreign contexts.
The number of active sessions being tracked is used to determine whether or not any session information needs to be reflected in the response (e.g., in the form of a response cookie). If no active sessions are associated with the request by the time the response is committed, no session information will be reflected in the response. See GlassFish Issue 896 for additional details.
| Constructor and Description |
|---|
SessionTracker() |
| Modifier and Type | Method and Description |
|---|---|
int |
getActiveSessions()
Gets the number of active sessions that are being tracked.
|
String |
getSessionId()
Gets the id of the sessions that are being tracked.
|
void |
reset()
Resets this session tracker.
|
void |
sessionEvent(SessionEvent event)
Processes the given session event, by unregistering this SessionTracker
as a session listener from the session that is the source of the event,
and by decrementing the counter of currently tracked sessions.
|
void |
setResponse(Response response)
Associates the given response with this SessionTracker.
|
void |
track(Session session)
Tracks the given session, by registering this SessionTracker as a
listener with the given session, and by incrementing the counter of
currently tracked sessions.
|
public void sessionEvent(SessionEvent event)
sessionEvent in interface SessionListenerevent - The session eventpublic int getActiveSessions()
public String getSessionId()
public void track(Session session)
session - The session to trackpublic void setResponse(Response response)
response - The response from which to remove the Set-Cookie
header if the number of tracked sessions drops to zeropublic void reset()
Copyright © 2017. All rights reserved.