Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http.server

public Class DefaultSessionManager

extends Object
implements SessionManager
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.http.server.SessionManager
Imports
java.util.Iterator, .Map, .Random, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, .ScheduledThreadPoolExecutor, .ThreadFactory, .TimeUnit, org.glassfish.grizzly.http.Cookie, org.glassfish.grizzly.http.server.util.Globals

Default SessionManager implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Random
private String
private final ScheduledThreadPoolExecutor
sessionExpirer

Scheduled Thread that clean the cache every XX seconds.

private final ConcurrentMap<String, Session>
sessions

Not Good.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
changeSessionId(final Request request, final Session session)

Implements org.glassfish.grizzly.http.server.SessionManager.changeSessionId.

Change the Session id and return the original id.

public void
configureSessionCookie(final Request request, final Cookie cookie)

Implements org.glassfish.grizzly.http.server.SessionManager.configureSessionCookie.

Configure session cookie before adding it to the Request#getResponse().

public Session
createSession(final Request request)

Implements org.glassfish.grizzly.http.server.SessionManager.createSession.

Create a new Session associated with the Request.

private long
generateRandomLong()

Returns pseudorandom positive long value.

public Session
getSession(final Request request, String requestedSessionId)

Implements org.glassfish.grizzly.http.server.SessionManager.getSession.

Return the session associated with this Request, creating one if necessary and requested.

public String
public static SessionManager
instance()

Returns: DefaultSessionManager singleton

public void
setSessionCookieName(final String name)

Implements org.glassfish.grizzly.http.server.SessionManager.setSessionCookieName.

Set the session cookie name that will be used by sessions created by this SessionManager.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rndback to summary
private final Random rnd
sessionCookieNameback to summary
private String sessionCookieName
sessionExpirerback to summary
private final ScheduledThreadPoolExecutor sessionExpirer

Scheduled Thread that clean the cache every XX seconds.

sessionsback to summary
private final ConcurrentMap<String, Session> sessions

Not Good. We need a better mechanism.

Todo

Move Session Management out of here

Constructor Detail

DefaultSessionManagerback to summary
private DefaultSessionManager()

Method Detail

changeSessionIdback to summary
public String changeSessionId(final Request request, final Session session)

Implements org.glassfish.grizzly.http.server.SessionManager.changeSessionId.

Doc from org.glassfish.grizzly.http.server.SessionManager.changeSessionId.

Change the Session id and return the original id.

Annotations
@Override
configureSessionCookieback to summary
public void configureSessionCookie(final Request request, final Cookie cookie)

Implements org.glassfish.grizzly.http.server.SessionManager.configureSessionCookie.

Doc from org.glassfish.grizzly.http.server.SessionManager.configureSessionCookie.

Configure session cookie before adding it to the Request#getResponse().

Annotations
@Override
createSessionback to summary
public Session createSession(final Request request)

Implements org.glassfish.grizzly.http.server.SessionManager.createSession.

Doc from org.glassfish.grizzly.http.server.SessionManager.createSession.

Create a new Session associated with the Request.

Annotations
@Override
generateRandomLongback to summary
private long generateRandomLong()

Returns pseudorandom positive long value.

getSessionback to summary
public Session getSession(final Request request, String requestedSessionId)

Implements org.glassfish.grizzly.http.server.SessionManager.getSession.

Doc from org.glassfish.grizzly.http.server.SessionManager.getSession.

Return the session associated with this Request, creating one if necessary and requested.

Annotations
@Override
getSessionCookieNameback to summary
public String getSessionCookieName()

Implements org.glassfish.grizzly.http.server.SessionManager.getSessionCookieName.

Annotations
@Override
instanceback to summary
public static SessionManager instance()
Returns:SessionManager

DefaultSessionManager singleton

setSessionCookieNameback to summary
public void setSessionCookieName(final String name)

Implements org.glassfish.grizzly.http.server.SessionManager.setSessionCookieName.

Doc from org.glassfish.grizzly.http.server.SessionManager.setSessionCookieName.

Set the session cookie name that will be used by sessions created by this SessionManager.

Annotations
@Override
org.glassfish.grizzly.http.server back to summary

private Class DefaultSessionManager.LazyHolder

extends Object
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.http.server.DefaultSessionManager.LazyHolder

Field Summary

Modifier and TypeField and Description
private static final DefaultSessionManager

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
private static final DefaultSessionManager INSTANCE

Constructor Detail

LazyHolderback to summary
private LazyHolder()