public class InMemorySessionManager extends Object implements SessionManager
ATTACHMENT_KEY
Constructor and Description |
---|
InMemorySessionManager(String id) |
InMemorySessionManager(String deploymentName,
int maxSessions) |
Modifier and Type | Method and Description |
---|---|
Session |
createSession(HttpServerExchange serverExchange,
SessionConfig config)
Creates a new session.
|
boolean |
equals(Object object) |
Set<String> |
getActiveSessions()
Returns the identifiers of those sessions that are active on this
node, excluding passivated sessions
|
Set<String> |
getAllSessions()
Returns the identifiers of all sessions, including both active and
passive
|
String |
getDeploymentName()
Uniquely identifies this session manager
|
Session |
getSession(HttpServerExchange serverExchange,
SessionConfig config) |
Session |
getSession(String sessionId)
Retrieves a session with the given session id
|
Set<String> |
getTransientSessions()
Returns the identifiers of those sessions that would be lost upon
shutdown of this node
|
int |
hashCode() |
void |
registerSessionListener(SessionListener listener)
Registers a session listener for the session manager
|
void |
removeSessionListener(SessionListener listener)
Removes a session listener from the session manager
|
void |
setDefaultSessionTimeout(int timeout)
Sets the default session timeout
|
void |
start()
Starts the session manager
|
void |
stop()
stops the session manager
|
String |
toString() |
public InMemorySessionManager(String deploymentName, int maxSessions)
public InMemorySessionManager(String id)
public String getDeploymentName()
SessionManager
getDeploymentName
in interface SessionManager
public void start()
SessionManager
start
in interface SessionManager
public void stop()
SessionManager
stop
in interface SessionManager
public Session createSession(HttpServerExchange serverExchange, SessionConfig config)
SessionManager
SessionListener
s registered with this manager will be notified
of the session creation.
This method *MUST* call SessionConfig.findSessionId(io.undertow.server.HttpServerExchange)
(io.undertow.server.HttpServerExchange)} first to
determine if an existing session ID is present in the exchange. If this id is present then it must be used
as the new session ID. If a session with this ID already exists then an IllegalStateException
must be
thrown.
This requirement exists to allow forwards across servlet contexts to work correctly.createSession
in interface SessionManager
public Session getSession(HttpServerExchange serverExchange, SessionConfig config)
getSession
in interface SessionManager
public Session getSession(String sessionId)
SessionManager
getSession
in interface SessionManager
sessionId
- The session IDpublic void registerSessionListener(SessionListener listener)
SessionManager
registerSessionListener
in interface SessionManager
listener
- The listenerpublic void removeSessionListener(SessionListener listener)
SessionManager
removeSessionListener
in interface SessionManager
listener
- the listenerpublic void setDefaultSessionTimeout(int timeout)
SessionManager
setDefaultSessionTimeout
in interface SessionManager
timeout
- the timeoutpublic Set<String> getTransientSessions()
SessionManager
getTransientSessions
in interface SessionManager
public Set<String> getActiveSessions()
SessionManager
getActiveSessions
in interface SessionManager
public Set<String> getAllSessions()
SessionManager
getAllSessions
in interface SessionManager
Copyright © 2014 JBoss by Red Hat. All rights reserved.