Package com.tangosol.coherence.servlet
Class SessionHelper
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.servlet.SessionHelper
A collection of methods that support the implementation of Coherence web
container components used to replace the corresponding implementations
provided by the application server vendor.
Must NOT be serializable just in case the application server implements clustering on the ServletContext level (because the session helper will be stored in the app server's ServletContext).
- Version:
- Coherence 2.3
- Author:
- cp 2003.07.21
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA daemon thread class that will clean up expired sessions.protected static interfaceInterface for detecting when a Runnable Task has completed.Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the resource that will be used to configure the session management module's own ConfigurableCacheFactory.static final StringThe key in the configuration cache for coordating cluster-wide session reaping.static final StringThe name of the application server context's attribute that Coherence stores its servlet context object under.static final StringThe configuration property that specifies whether non-serializable attributes should be preserved as local.static final StringThe configuration property that overrides the name of the web application.protected static final StringWhether the application name was generated by Coherence*Webstatic final StringThe configuration property for the "split" model that overrides the length that attributes must be below to be stored inside a session ("embedded") or above which they will be stored in the separated "overflow" cache ("external").static final StringThe configuration property that indicates which cache configuration path name will be used.static final StringThe configuration property that defines the cache delegator class.static final StringThe name of the Coherence cache that will be used to hold the servlet context data if the servlet context is clustered by Coherence.static final StringThe configuration property that overrides the name of the local cache that stores non-distributed session attributes (if allowed.)static final StringThe configuration property that overrides the name of the local cache that stores non-distributed sessions when the SessionDistributionController option is implemented.static final StringThe configuration property that overrides the name of the clustered cache that stores the sessions management configuration data.static final StringThe configuration property that overrides the name of the clustered cache that stores the "overflowing" (split-out due to size) session attributes.static final StringThe configuration property that overrides the name of the clustered cache that stores the sessions.static final StringThe name of the application server context's initialization parameter that specifies whether the ServletContext attribute values will be clustered.static final StringTrue if the cluster software is deployed as part of the application and thus must be shut down fully by the application when it shuts down.static final StringThe name of the application server context's initialization parameter that specifies the fully qualified class name of the HttpSessionCollection implementation to use.static final StringThe configuration property that indicates whether configuration consistency should be checked.static final StringThe domain of the session cookie.static final StringTrue to ensure that the session cookie is only send from the browser uising the http/https connection.static final StringThe maximum age in seconds of the session cookie.static final StringThe name of the session cookie.static final StringThe path of the session cookie.static final StringTrue to ensure that the session cookie is only sent from a web client over a SSL connection.static final StringTrue to enable session cookies.static final StringTrue to assume that the sessions in the cache are split across only the servers that are doing reaping.static final StringTrue to coordinate reaping in the cluster such that only one server will perform reaping within a given reaping cycle, and it will check all session ids in the cluster.static final StringThe number of seconds that the daemon rests between reaping.static final StringConfiguration parameter for setting the maximum number of threads for the session reaper daemon.static final StringConfiguration parameter for setting the minimum number of threads for the session reaper daemon.static final StringConfiguration parameter for enabling parallel session reaping.static final StringThe priority for the session reaper daemon.static final StringConfiguration parameter for setting the queue size of the session reaper work manager.static final StringThe number of times that the reaper reaps the sessions that are being used locally before it will check sessions that may be orphaned or expired elsewhere in the cluster.static final StringThe configuration property that specifies an implementation of the SessionDistributionController interface to use.static final StringDetermines if attribute listeners should be executed if the same instance of a session attribute is being replaced in the session.static final StringEnable Debug logging for Session access, creation, invalidation, and attribute access/insertion/update/removalstatic final StringWhether we try to determine suspect attributes.static final StringThe name of the application server context's initialization parameter that specifies the fully qualified class name of the SessionHelper Factory to use.static final StringIn the filter's configuration, the name of the filter class that is wrapped by the Coherence filter.static final StringThe comma-delimited list of names of application classes that wish to receive events from the web container.static final StringThe configuration property that specifies whether an diagnostic invocation service is executed when a member is unable to acquire the cluster lock for a session.static final StringConfiguration parameter for setting the logger level for this Coherence*Web instance.static final StringThe configuration property that specifies an implementation of the AttributeScopeController interface to use.static final StringThe configuration property that specifies the name of the invocation service that will be used to manage sticky session ownership.static final StringIn the servlet's configuration, the name of the servlet class that is wrapped by the Coherence servlet.static final StringComma separated list of session attribute prefixes not to be loggedstatic final StringThe configuration property that specifies session id affinity suffix token.static final StringThe configuration property that specifies application level session locking.static final StringThe configuration property that indicates whether the session cache needs to be federatedstatic final StringThe configuration property that overrides the session expirty time.protected static final StringParameter name for specifying a custom session expiry filter factorystatic final StringThe configuration property that specifies session lock acquisition timeout.static final StringThe configuration property that specifies the fully qualified class name of the HttpSessionIdGenerator implementation to use.static final StringThe configuration property that overrides the session id length.static final StringThe configuration property that allows lazy access to a session.static final StringThe configuration property that specifies that session locking is enabled.static final StringThe configuration property that sets the session locking Configuration: in one step.static final StringThe configuration property that specifies valid application locking mode value.static final StringThe configuration property that specifies valid member locking mode value.static final StringThe configuration property that specifies valid none locking mode value.static final StringThe configuration property that specifies valid optimistic locking mode value.static final StringThe configuration property that specifies valid thread locking mode value.static final StringThe configuration property that specifies if Coherence*Web is to log exceptions thrown by session attribute listeners during invalidation.static final StringThe configuration property that specifies member level session locking.static final StringThe configuration property that indicates the mechanism which will be used by the session reaper to delete timed-out sessions.static final Stringstatic final StringThe length of time to defer async exit on a session that is accessed "out of context".static final StringThe configuration property that specifies whether sticky sessions optimizations will be used.static final StringThe configuration property that specifies strict spec adherence.static final StringThe configuration property that specifies thread level session locking.static final StringTrue to allow the application to iterate sessions from the session context, thus disobeying the deprecation in the servlet spec.static final StringThe configuration property that overrides the shutdown delay time.static final StringTrue to use the container's decoding of the URL session ID.static final StringTrue to use the container's encoding of the URL session ID.static final StringTrue to enable URL encoding of session ids.static final StringThe parameter name to encode the session id into the URL with.static final StringThe name of the template resource that will be used to configure the session management module's own ConfigurableCacheFactory.static final StringThe default cache name for the ServletContext attribute map.static final StringThe file name of the federated default cache configuration filestatic final StringThe default cache name for the session management configuration data.static final StringThe context parameter value to be set if Default (invalidation) is to be used as Reaping Mechanism.static final intThe internal enum for an attribute-added event.static final intThe internal enum for an attribute-removed event.static final intThe internal enum for an attribute-replaced event.protected static final StringA key for a cache entry indicating we copied the data from replicated cache to the view.protected ConfigurableCacheFactoryThe session management module's own ConfigurableCacheFactory.static final FilterThe Filter object that hides init param names for Coherence params.protected static final StringThe first version that do not use replicated cache.protected static final StringThe first 14.1.1.2206 patch that do not use replicated cache.static final StringThe product name banner.static final StringThe context parameter value to be set if Remote Delete is to be used as reaping mechanism.protected static final StringThe replicated cache service name.static final StringThe name of the request attribute that stores a request reference counter.static final StringThe name of the request attribute that stores the current Coherence HttpSession instance.static final StringThe name of the request attribute that tests if the Coherence wrapper is in place.static ListA singleton list of all collections on this server used for sticky session optimzationstatic final ThreadLocal<Boolean> When a session needs to be invalidated, the removal must be synthetic remove in case the invalidation is coming from the reaper.static final StringThe internal request attribute for tracking that a session affinity suffix has stripped off the session id. -
Constructor Summary
ConstructorsConstructorDescriptionSessionHelper(SessionHelperFactory factory, javax.servlet.ServletContext ctx) Construct a Coherence SessionHelper that will support the implementation of clustered web container services. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIgnoreAttributeName(String sName) Register a name to ignore events for.protected voidcheckConfigConsistency(com.tangosol.coherence.servlet.ValidatingConfiguration configuration) Check that configuration is consistent with that of existing members.protected voidDiscard the HttpSession objects that are no longer alive.protected voidcleanUpSession(String sessionId) Does any addition clean up necessary for the deleted sessions.voidRemoves the storeSessd configuration.protected voidCalled immediately after construction.protected voidvoidCalled by the Coherence ServletContextListener on contextDestroyed() if an event listener is registered.voidCalled by the Coherence ServletContextListener on contextInitialized() if an event listener is registered.javax.servlet.http.HttpSessionCreate a new HttpSession object.createRequestContext(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) Given the specified request and response, provide a request context.protected com.tangosol.coherence.servlet.ServiceHelperCreate a ServiceHelper.decodeCookie(javax.servlet.http.HttpServletRequest req) Obtain a session ID from a request object by examining the cookies attached to the request.protected StringdecodeUrl(javax.servlet.http.HttpServletRequest request) Decodes the session ID from the URL represented by the passed request.voiddispatchAttributeEvent(int nEvent, javax.servlet.ServletContextAttributeEvent evt) Dispatch a wrapped event to the application listeners.voiddispatchInternalAttributeEvent(int nEvent, javax.servlet.ServletContextAttributeEvent evt) Dispatch a wrapped event to the application listeners.voidencodeCookie(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String sId, boolean fNew) Encode a session ID into a cookie and attach it to the response object.protected StringEncodes the specified URL by including the given session ID in it.Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.protected voidEnsure the coherence cluster.protected NamedCacheGet the NamedCache used to store configuration and management information for the session management implementation if it exists, otherwise create it.javax.servlet.http.HttpSessionensureHttpSession(String sId) Get the HttpSession object for the specified ID.protected NamedCacheGet the clustered attribute map if it exists, otherwise create it (if the ServletContext is supposed to be clustered).Get the daemon thread that is used for scheduled tasks, creating it if necessary.voidenterSession(String sId) Obtain any necessary ownership for the specified session.voidexitSession(String sId, boolean fNew) Release ownership for the specified session.voidfilter(javax.servlet.Filter filter, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp, javax.servlet.FilterChain chain) Issue the service call to the specified servlet, given the passed request and response objects.voidCalled by each Coherence Filter wrapper on destroy().voidCalled by each Coherence Filter wrapper on init().static StringformatCacheName(NamedCache cache) Format a NamedCache object into a human readable string.static StringformatListeners(Listeners listeners) Format a Listeners object into a human readable string.static StringformatMapKeys(Map<?, ?> map) Format a map into a list of keys.protected StringReturn the name of the web application.Obtain a session management cache by name.static StringgetCacheConfigPath(javax.servlet.ServletContext servletContext, ClassLoader appClassLoader) Get the cache configuration pathDetermine the current configuration of the object.Obtain the ConfigurableCacheFactory used by the SessionHelper.Get the NamedCache used to store configuration and management information for the session management implementation.protected com.tangosol.coherence.servlet.ConfigurationConsistencyVerifierGet a ConfigurationConsistencyVerifier instance.protected ListenersGet the application listeners that listen to servlet context attribute events.protected intDetermine how many times the daemon will perform its check before checking the session models that the collection considers "local".protected longDetermine the number of milliseconds per reap cycle.protected intDetermine the configured priority for the session reaper daemon.protected StringReturns a string representation of this object's attributes.Determine the factory to use to instantiate container-specific implementations of the Servlet specification interfaces.javax.servlet.http.HttpSessiongetHttpSession(String sId) Get the HttpSession object for the specified ID.javax.servlet.http.HttpSessiongetHttpSession(javax.servlet.http.HttpServletRequest req) Return the HttpSession associated with the given request.Get the HttpSessionCollection object that manages the HttpSessionModel objects.javax.servlet.http.HttpSessionContextGet the HttpSessionContext.protected MapGet the map of session ID to session object for HttpSession objects managed in this application within this JVM/classloader.getInvocationService(String sService) Obtain a session management invocation service by name.Get the application listeners.Gets session ids for all sessions that are in the local map, i.e. has been accessed by this node.protected StringReturn a string representation of the ObjectName used to register the MBean instance for this SessionHelper.protected com.tangosol.coherence.servlet.SessionHelper.ReapTaskFactoryGetter for reap task factory.protected RegistryGet the management registry from the CacheFactoryjavax.servlet.ServletContextReturns the Coherence ServletContext wrapper that this SessionHelper is helping with.Get the clustered attribute map.intReturns the major version of the Java Servlet API that this servlet container supports.intReturns the minor version of the Servlet API that this servlet container supports.Retrieve the session id affinity suffix token if one is defined.Determine the domain of the cookie for holding the session ID.booleanDetermine if a web client will only send the session using the initial http/https connection.intDetermine the max age (in seconds) of the cookie for holding the session ID.Determine the name of the cookie for holding the session ID.Determine the path of the cookie for holding the session ID.booleanDetermine if a web client will only send the session cookie over a SSL connection.Determine the name of the URL parameter for session ID encoding and decoding.protected SessionHelper.SessionReaperDaemonGet the daemon thread that cleans up expired sessions.Returns the session reaping mechanism that is used in the application.protected TaskDaemonGet the daemon thread that is used for scheduled tasks.protected longDetermine the number of milliseconds to defer shutdown after the app appears to have stopped.protected WorkManagerGets a WorkManager for use by the parallel reap task.protected intReturns the maximum number of threads used by the work manager.protected intReturns the minimum number of threads used by the work manager.com.tangosol.coherence.servlet.api24.HttpServletRequestWrapperGet the wrapped HttpServletRequest.javax.servlet.ServletContextReturns the application server's ServletContext that this SessionHelper is helping with.protected CoherenceHttpSessionCollectionGet the HttpSessionCollection object that manages the HttpSessionModel objects.protected ObjectFactory Method: Instantiate a MBean implementation for this SessionHelper.protected SessionHelper.SessionReaperDaemonFactory method: Instantiate a daemon thread that will clean up expired sessions.protected TaskDaemonFactory method: Instantiate a daemon thread that will be used for scheduled tasks.protected booleanisAttributeNameIgnored(String sName) Test to see if events for the specified name should be ignored.protected booleanDetermine if the responsibility for shutting down the cluster is owned by the application.protected booleanDetermine if the reaper daemon assumes that session data is stored only on nodes that are running the session reaper daemon thread.protected booleanDetermine if the reaper daemon coordinates the check across the cluster instead of just doing its own "local" scan.static booleanbooleanDetermine if the context clusters attributes.booleanisServletRequestWrapped(javax.servlet.ServletRequest req) Test to see if the passed ServletRequest is wrapped, which means that invoking a method on the passed ServletRequest object will invoke the Coherence implementation, and will do so before the container implementation is invoked.booleanDetermine if the session context should disobey the deprecation and allow an application to enumerate sessions.booleanisSessionIdCookie(javax.servlet.http.Cookie cookie) Tests to see if the supplied cookie is a session ID cookie.booleanDetermine if a cookie may be used to hold the session ID.booleanDetermine if URL encoding may be used to hold the session ID.booleanIf true, replace the session id affinity suffix token with the configured affinity token for this server.booleanisStrict()Determine if the Servlet specification is being followed strictly.static booleanbooleanDetermine if the session ID decoding (from a URL) performed by the application server's request object is sufficient.booleanDetermine if the session ID encoding (into a URL) performed by the application server's response object is sufficient.voidkillSession(String sId) Forcibly destroy a session.static voidlogEventException(RuntimeException e, String sMethod, boolean fContinue) Log an event exception.voidLog the warning that session listener is being added even though the reaper mechanism used is RemoteDeletevoidonGetHttpSession(javax.servlet.http.HttpServletRequest req) Allow service helper to perform actions on getSession calls.static booleanparseBoolean(javax.servlet.ServletContext ctx, String sParam, boolean fDefault) Helper: Get a boolean init parameter from the context.static intHelper: Get an int init parameter from the context.static StringparseString(javax.servlet.ServletContext ctx, String sParam, String sDefault) Helper: Get a String init parameter from the context.voidFinish the request processing after the servlet/jsp is complete.preService(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) Wrap the passed request and response (if necessary) and build a request context that contains all the pertinent information about the request.protected voidRegister an MBean instance for this SessionHelper.voidRemove the session object cached in the local session map.voidremoveIgnoreAttributeName(String sName) Unregister a name to ignore events for.voidEnter (obtain) and schedule an asynchronous call to exit (release) the specified session ID.voidservice(javax.servlet.Servlet servlet, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) Issue the service call to the specified servlet, given the passed request and response objects.voidCalled by each Coherence Servlet wrapper on destroy().voidCalled by each Coherence Servlet wrapper on init().voidsetConfig(XmlElement xml) Specify the configuration for the object.voidsetConfigurableCacheFactory(ConfigurableCacheFactory cacheFactory) Sets the global cache factory instance used by Coherence*Web.voidsetHttpSession(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpSession session) Associate the supplied HttpSession with the given request.static voidsetIsReaperThread(boolean isReaperThread) voidsetListeners(Listeners listeners) Store the application listeners.protected voidsetSessionWorkerDaemon(TaskDaemon daemon) Set the daemon thread that is used for scheduled tasks.voidsetWrappedHttpServletReq(com.tangosol.coherence.servlet.api24.HttpServletRequestWrapper req) Set the wrapped HttpServletRequest.protected voidshutdown()Shuts down the SessionHelper and any mess that it created.protected voidShutdown the NamedCache used to store configuration and management information for the session management implementation.voidShutdown the http session collection.protected voidShutdown the clustered attribute map.protected voidprotected voidvoidStop the daemon thread that is used for expiring sessions.voidStop the daemon thread that is used for scheduled tasks.toString()Returns a string representation of the object.protected voidUnregister the MBean instance for this SessionHelper.static voidjavax.servlet.FilterConfigunwrapFilterConfig(javax.servlet.FilterConfig cfg) Attempt to unwrap the passed FilterConfig wrapper to get the container's FilterConfig object back.javax.servlet.ServletConfigunwrapServletConfig(javax.servlet.ServletConfig cfg) Attempt to unwrap the passed ServletConfig wrapper to get the container's ServletConfig object back.javax.servlet.ServletRequestunwrapServletRequest(javax.servlet.ServletRequest req) Fully unwrap the specified request object.updateSessionId(String sId, String sNewId) Updates the session model id to a new session id.javax.servlet.FilterConfigwrapFilterConfig(javax.servlet.FilterConfig cfg) Given the specified FilterConfig object, return a wrapper to use.javax.servlet.ServletConfigwrapServletConfig(javax.servlet.ServletConfig cfg) Given the specified servlet config object, return a wrapper to use.javax.servlet.ServletRequestwrapServletRequest(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) Given the specified request, create a request wrapper.Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
PRODUCT_BANNER
The product name banner. -
CACHE_CONFIGURATION_PATH
The name of the resource that will be used to configure the session management module's own ConfigurableCacheFactory.- See Also:
-
DEFAULT_CACHE_CONFIGURATION_PATH
The name of the template resource that will be used to configure the session management module's own ConfigurableCacheFactory.- See Also:
-
EVT_ADDED
public static final int EVT_ADDEDThe internal enum for an attribute-added event.- See Also:
-
SESSION_AFFINITY_SUFFIX_STRIPPED
The internal request attribute for tracking that a session affinity suffix has stripped off the session id.- See Also:
-
EVT_REMOVED
public static final int EVT_REMOVEDThe internal enum for an attribute-removed event.- See Also:
-
EVT_REPLACED
public static final int EVT_REPLACEDThe internal enum for an attribute-replaced event.- See Also:
-
CTX_INIT_CONFIGURATION_CONSISTENCY
The configuration property that indicates whether configuration consistency should be checked.- See Also:
-
CTX_INIT_APPLICATION_NAME
The configuration property that overrides the name of the web application.- See Also:
-
CTX_INIT_FACTORY
The name of the application server context's initialization parameter that specifies the fully qualified class name of the SessionHelper Factory to use.- See Also:
-
CTX_INIT_COLLECTION
The name of the application server context's initialization parameter that specifies the fully qualified class name of the HttpSessionCollection implementation to use.- See Also:
-
CTX_INIT_CLUSTER_OWNED
True if the cluster software is deployed as part of the application and thus must be shut down fully by the application when it shuts down. For example, this should be set to true if coherence.jar is deployed within the application "WAR" file.- See Also:
-
CTX_INIT_CLUSTER
The name of the application server context's initialization parameter that specifies whether the ServletContext attribute values will be clustered. If the configuration value is "true", then all ServletContext attribute values must be serializable.- See Also:
-
CTX_INIT_CACHENAME_CONTEXT
The name of the Coherence cache that will be used to hold the servlet context data if the servlet context is clustered by Coherence.- See Also:
-
CTX_INIT_LISTENS
The comma-delimited list of names of application classes that wish to receive events from the web container.- See Also:
-
CTX_INIT_SESSIONCONTEXT_ENABLED
True to allow the application to iterate sessions from the session context, thus disobeying the deprecation in the servlet spec.- See Also:
-
CTX_INIT_SESSION_RETAIN_MILLIS
The length of time to defer async exit on a session that is accessed "out of context".- See Also:
-
CTX_INIT_COOKIES_ENABLED
True to enable session cookies.- See Also:
-
CTX_INIT_COOKIE_NAME
The name of the session cookie.- See Also:
-
CTX_INIT_COOKIE_DOMAIN
The domain of the session cookie.- See Also:
-
CTX_INIT_COOKIE_PATH
The path of the session cookie.- See Also:
-
CTX_INIT_COOKIE_MAX_AGE
The maximum age in seconds of the session cookie.- See Also:
-
CTX_INIT_COOKIE_SECURE
True to ensure that the session cookie is only sent from a web client over a SSL connection.- See Also:
-
CTX_INIT_COOKIE_HTTPONLY
True to ensure that the session cookie is only send from the browser uising the http/https connection.- See Also:
-
CTX_INIT_URLENCODE_ENABLED
True to enable URL encoding of session ids.- See Also:
-
CTX_INIT_URLENCODE_NAME
The parameter name to encode the session id into the URL with.- See Also:
-
CTX_INIT_URLDECODE_DEFAULT
True to use the container's decoding of the URL session ID.- See Also:
-
CTX_INIT_URLENCODE_DEFAULT
True to use the container's encoding of the URL session ID.- See Also:
-
CTX_INIT_DAEMON_PRIORITY
The priority for the session reaper daemon.- See Also:
-
CTX_INIT_DAEMON_CYCLE_SECS
The number of seconds that the daemon rests between reaping.- See Also:
-
CTX_INIT_DAEMON_COORDINATED
True to coordinate reaping in the cluster such that only one server will perform reaping within a given reaping cycle, and it will check all session ids in the cluster.- See Also:
-
CTX_INIT_DAEMON_ASSUME_LOCALITY
True to assume that the sessions in the cache are split across only the servers that are doing reaping.- See Also:
-
CTX_INIT_DAEMON_SWEEP_MODULO
The number of times that the reaper reaps the sessions that are being used locally before it will check sessions that may be orphaned or expired elsewhere in the cluster.- See Also:
-
CTX_INIT_DAEMON_PARALLEL
Configuration parameter for enabling parallel session reaping. Defaults to "false".- See Also:
-
CTX_INIT_DAEMON_MIN_THREADS
Configuration parameter for setting the minimum number of threads for the session reaper daemon.- See Also:
-
CTX_INIT_DAEMON_MAX_THREADS
Configuration parameter for setting the maximum number of threads for the session reaper daemon.- See Also:
-
CTX_INIT_DAEMON_QUEUE_SIZE
Configuration parameter for setting the queue size of the session reaper work manager. This is only used when parallel reaping is enabled and not using the SPI.- See Also:
-
CTX_INIT_LOGGER_LEVEL
Configuration parameter for setting the logger level for this Coherence*Web instance.- See Also:
-
CTX_INIT_CACHENAME_MANAGEMENT
The configuration property that overrides the name of the clustered cache that stores the sessions management configuration data.- See Also:
-
CTX_INIT_CACHENAME_SESSIONS
The configuration property that overrides the name of the clustered cache that stores the sessions.- See Also:
-
CTX_INIT_CACHENAME_OVERFLOW
The configuration property that overrides the name of the clustered cache that stores the "overflowing" (split-out due to size) session attributes. Only used for the "Split" model.- See Also:
-
CTX_INIT_CACHENAME_LOCAL_SESSIONS
The configuration property that overrides the name of the local cache that stores non-distributed sessions when the SessionDistributionController option is implemented.- See Also:
-
CTX_INIT_CACHENAME_LOCAL_ATTRIBUTES
The configuration property that overrides the name of the local cache that stores non-distributed session attributes (if allowed.)- See Also:
-
CTX_INIT_SESSION_EXPIRE_SECS
The configuration property that overrides the session expirty time.- See Also:
-
CTX_INIT_SESSION_ID_LENGTH
The configuration property that overrides the session id length.- See Also:
-
CTX_INIT_SESSION_ID_GENERATOR_CLASS
The configuration property that specifies the fully qualified class name of the HttpSessionIdGenerator implementation to use.- See Also:
-
CTX_INIT_CACHE_DELEGATOR_CLASS
The configuration property that defines the cache delegator class.- See Also:
-
CTX_INIT_SESSION_LOG_INVALIDATION_EXCEPTIONS
The configuration property that specifies if Coherence*Web is to log exceptions thrown by session attribute listeners during invalidation.- See Also:
-
CTX_INIT_ATTR_OVERFLOW_THRESHOLD
The configuration property for the "split" model that overrides the length that attributes must be below to be stored inside a session ("embedded") or above which they will be stored in the separated "overflow" cache ("external").- See Also:
-
CTX_INIT_SESSION_LOCK
The configuration property that specifies that session locking is enabled.- See Also:
-
CTX_INIT_SESSION_MEMBER_LOCK
The configuration property that specifies member level session locking.- See Also:
-
CTX_INIT_SESSION_APP_LOCK
The configuration property that specifies application level session locking.- See Also:
-
CTX_INIT_SESSION_THREAD_LOCK
The configuration property that specifies thread level session locking.- See Also:
-
CTX_INIT_SESSION_GET_LOCK_TIMEOUT
The configuration property that specifies session lock acquisition timeout.- See Also:
-
CTX_INIT_SESSION_AFFINITY_TOKEN
The configuration property that specifies session id affinity suffix token.- See Also:
-
CTX_INIT_SESSION_REPLACE_AFFINITY_TOKEN
- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE
The configuration property that sets the session locking Configuration: in one step. Legal values: none, optimistic, member, app, thread. This is a no-op if not configured or if an improper value is used. If used this will overwrite any set operations on individual properties.- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE_APP
The configuration property that specifies valid application locking mode value.- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE_MEMBER
The configuration property that specifies valid member locking mode value.- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE_NONE
The configuration property that specifies valid none locking mode value.- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE_OPTIMISTIC
The configuration property that specifies valid optimistic locking mode value.- See Also:
-
CTX_INIT_SESSION_LOCKING_MODE_THREAD
The configuration property that specifies valid thread locking mode value.- See Also:
-
CTX_INIT_LOG_THREADS_HOLDING_LOCK
The configuration property that specifies whether an diagnostic invocation service is executed when a member is unable to acquire the cluster lock for a session. The invocation service will cause the member that has ownership of the session to log the stack trace of the threads that are currently holding the lock.- See Also:
-
CTX_INIT_SESSION_STRICT_SPEC
The configuration property that specifies strict spec adherence.- See Also:
-
CTX_INIT_SESSION_LAZY_ACCESS
The configuration property that allows lazy access to a session. Default is false. When false, the session is fetched on entry into a servlet's service method. When true, it is only fetched on getSession.- See Also:
-
CTX_INIT_SHUTDOWN_DELAY_SECS
The configuration property that overrides the shutdown delay time.- See Also:
-
CTX_INIT_SERVLET
In the servlet's configuration, the name of the servlet class that is wrapped by the Coherence servlet.This is used in a web-xml
element to designate the application servlet name that the Coherence implementation is being wrapped around; this must be done for each application servlet.<servlet>Before:
<servlet> <servlet-name>MyServlet</servlet-name> <display-name>MyServlet</display-name> <description>this servlet is part of my app</description> <servlet-class>com.mypkg.MyServlet</servlet-class> <init-param> <param-name>ContextPath</param-name> <param-value>/tomcat</param-value> </init-param> </servlet>After:
<servlet> <servlet-name>MyServlet</servlet-name> <display-name>MyServlet</display-name> <description>this servlet is part of my app</description> <servlet-class>com.tangosol.coherence.servlet.api22.HttpServletWrapper</servlet-class> <init-param> <param-name>ContextPath</param-name> <param-value>/tomcat</param-value> </init-param> <init-param> <param-name>coherence-servlet-class</param-name> <param-value>com.mypkg.MyServlet</param-value> </init-param> </servlet>- See Also:
-
CTX_INIT_FILTER
In the filter's configuration, the name of the filter class that is wrapped by the Coherence filter.This is used in a web-xml
element to designate the application filter name that the Coherence implementation is being wrapped around; this must be done for each application filter.<filter>- See Also:
-
CTX_INIT_DIST_CONTROLLER_CLASS
The configuration property that specifies an implementation of the SessionDistributionController interface to use.- See Also:
-
CTX_INIT_SCOPE_CONTROLLER_CLASS
The configuration property that specifies an implementation of the AttributeScopeController interface to use.- See Also:
-
CTX_INIT_SESSION_STICKY
The configuration property that specifies whether sticky sessions optimizations will be used. This should only be turned on if a sticky load balancer is being used.- See Also:
-
CTX_INIT_SERVICENAME_OWNERSHIP
The configuration property that specifies the name of the invocation service that will be used to manage sticky session ownership.- See Also:
-
CTX_INIT_ALLOW_LOCAL_ATTRIBUTES
The configuration property that specifies whether non-serializable attributes should be preserved as local.- See Also:
-
CTX_INIT_ENABLE_SUSPECT_ATTRIBUTES
Whether we try to determine suspect attributes. With this set to "true", attributes that are deemed to be mutable (detected with a simple check) and which are accessed through a get, are deemed to be suspect in that they may have been changed in application code. Suspect attributes are treated as changed. Defaults to "true".- See Also:
-
CTX_INIT_ENABLE_ATTR_LISTENER_OPTIMIZATION
Determines if attribute listeners should be executed if the same instance of a session attribute is being replaced in the session.- See Also:
-
CTX_INIT_APPLICATION_NAME_GENERATED
Whether the application name was generated by Coherence*Web- See Also:
-
CTX_INIT_SESSION_EXPIRY_FILTER_FACTORY
Parameter name for specifying a custom session expiry filter factory- See Also:
-
CTX_INIT_ENABLE_SESSION_ACCESS_DEBUG_LOGGING
Enable Debug logging for Session access, creation, invalidation, and attribute access/insertion/update/removal- See Also:
-
CTX_INIT_SESSION_ACCESS_DEBUG_LOGGING_FILTER
Comma separated list of session attribute prefixes not to be logged- See Also:
-
CTX_INIT_CACHE_CONFIGURATION_PATH
The configuration property that indicates which cache configuration path name will be used. This overrides the default "session-cache-config.xml"- See Also:
-
CTX_INIT_SESSION_CACHE_FEDERATED
The configuration property that indicates whether the session cache needs to be federated- See Also:
-
CTX_INIT_SESSION_REAPING_MECHANISM
The configuration property that indicates the mechanism which will be used by the session reaper to delete timed-out sessions. The default value is 'Default' which will remove the session after fetching the session to the local JVM and calling the invalidate method of the HTTP session as per the specification in javax.servlet.http.HttpSession. Coherence*Web also provides an alternate reaping mechanism called 'RemoteDelete' which will remove the timed-out sesions from the session cache using an EntryProcessor. This mechanism will not call the invalidate method of the HttpSession and hence the session listeners will not be invoked in this case. Session Reaping using 'RemoteDelete' will be much faster than the default mechanism, but should only be used in applications which do not use session listeners.- See Also:
-
CTX_ATTR_CONTEXT
The name of the application server context's attribute that Coherence stores its servlet context object under.Also, the name of the request attribute used to store the request context.
- See Also:
-
REQ_ATTR_COUNT
The name of the request attribute that stores a request reference counter.- See Also:
-
REQ_ATTR_SESSION
The name of the request attribute that stores the current Coherence HttpSession instance.- See Also:
-
REQ_ATTR_TEST
The name of the request attribute that tests if the Coherence wrapper is in place.- See Also:
-
DEFAULT_CTXNAME
The default cache name for the ServletContext attribute map.- See Also:
-
DEFAULT_MGTNAME
The default cache name for the session management configuration data.- See Also:
-
CFG_KEY_REAPER
The key in the configuration cache for coordating cluster-wide session reaping.- See Also:
-
DEFAULT_FEDERATED_CACHE_CONFIGURATION_PATH
The file name of the federated default cache configuration file- See Also:
-
REMOTE_DELETE_REAPING_MECHANISM
The context parameter value to be set if Remote Delete is to be used as reaping mechanism.- See Also:
-
DEFAULT_REAPING_MECHANISM
The context parameter value to be set if Default (invalidation) is to be used as Reaping Mechanism.- See Also:
-
NAME_FILTER
The Filter object that hides init param names for Coherence params. -
NO_REPLICATED_VERSION
The first version that do not use replicated cache.- Since:
- 22.06.4
- See Also:
-
NO_REPLICATED_VERSION_2206
The first 14.1.1.2206 patch that do not use replicated cache.- Since:
- 22.06.4
- See Also:
-
REPLICATED_SERVICE
The replicated cache service name.- Since:
- 22.06.4
- See Also:
-
KEY_MIGRATED
A key for a cache entry indicating we copied the data from replicated cache to the view.- Since:
- 22.06.4
- See Also:
-
m_cachefactory
The session management module's own ConfigurableCacheFactory. -
s_collections
A singleton list of all collections on this server used for sticky session optimzation -
s_tloReaperFlag
When a session needs to be invalidated, the removal must be synthetic remove in case the invalidation is coming from the reaper. This is because in case of federation, we want the session invalidation to be a local event as if it is not local, it can lead to unwanted session deletion if there is a pause/break in federation.
-
-
Constructor Details
-
SessionHelper
Construct a Coherence SessionHelper that will support the implementation of clustered web container services.- Parameters:
factory- the object that will instantiate the container-specific (or servlet spec specific) implementationsctx- the application server's ServletContext object
-
-
Method Details
-
configure
protected void configure()Called immediately after construction. -
shutdownSessionHelper
protected void shutdownSessionHelper() -
shutdownSessionHelperCaches
-
configureLogger
protected void configureLogger() -
ensureCluster
protected void ensureCluster()Ensure the coherence cluster. -
checkConfigConsistency
protected void checkConfigConsistency(com.tangosol.coherence.servlet.ValidatingConfiguration configuration) Check that configuration is consistent with that of existing members.- Parameters:
configuration- the validating configuration- Throws:
IllegalStateException- if configuration is inconsistent
-
getConfigurationConsistencyVerifier
protected com.tangosol.coherence.servlet.ConfigurationConsistencyVerifier getConfigurationConsistencyVerifier()Get a ConfigurationConsistencyVerifier instance.- Returns:
- a ConfigurationConsistencyVerifier instance
-
clearStoredConfiguration
public void clearStoredConfiguration()Removes the storeSessd configuration. -
getConfig
Determine the current configuration of the object.- Returns:
- the XML configuration or null
-
setConfig
Specify the configuration for the object.- Parameters:
xml- the XML configuration for the object- Throws:
IllegalStateException- if the object is not in a state that allows the configuration to be set; for example, if the object has already been configured and cannot be reconfigured
-
setConfigurableCacheFactory
Sets the global cache factory instance used by Coherence*Web. This can be set either when the first application is deployed or by the container during startup.- Parameters:
cacheFactory- the configurable cache factory
-
getConfigurableCacheFactory
Obtain the ConfigurableCacheFactory used by the SessionHelper.- Returns:
- the ConfigurableCacheFactory used by the SessionHelper
-
getCacheConfigPath
public static String getCacheConfigPath(javax.servlet.ServletContext servletContext, ClassLoader appClassLoader) Get the cache configuration path- Parameters:
servletContext- the servlet contextappClassLoader- the application classloader- Returns:
- the cache configuration path
-
getCache
Obtain a session management cache by name.- Parameters:
sCacheName- the name of the cache to obtain- Returns:
- the NamedCache
-
getInvocationService
Obtain a session management invocation service by name.- Parameters:
sService- the name of the invocation service to obtain- Returns:
- the InvocationService
-
getApplicationName
Return the name of the web application.- Returns:
- the name of the web application; never null or empty
-
getMBeanObjectName
Return a string representation of the ObjectName used to register the MBean instance for this SessionHelper.- Returns:
- a string representation of the ObjectName
-
instantiateMBean
Factory Method: Instantiate a MBean implementation for this SessionHelper.- Returns:
- a new MBean instance
-
registerMBean
protected void registerMBean()Register an MBean instance for this SessionHelper. -
unregisterMBean
protected void unregisterMBean()Unregister the MBean instance for this SessionHelper. -
getRegistry
Get the management registry from the CacheFactory- Returns:
- the management registry
-
contextInitialized
public void contextInitialized()Called by the Coherence ServletContextListener on contextInitialized() if an event listener is registered. -
getWrappedHttpServletReq
public com.tangosol.coherence.servlet.api24.HttpServletRequestWrapper getWrappedHttpServletReq()Get the wrapped HttpServletRequest.- Returns:
- the wrapped HttpServletRequest
-
setWrappedHttpServletReq
public void setWrappedHttpServletReq(com.tangosol.coherence.servlet.api24.HttpServletRequestWrapper req) Set the wrapped HttpServletRequest.- Parameters:
req- the wrapped HttpServletRequest to set to
-
contextDestroyed
public void contextDestroyed()Called by the Coherence ServletContextListener on contextDestroyed() if an event listener is registered. -
servletInitialized
public void servletInitialized()Called by each Coherence Servlet wrapper on init(). -
servletDestroyed
public void servletDestroyed()Called by each Coherence Servlet wrapper on destroy(). -
filterInitialized
public void filterInitialized()Called by each Coherence Filter wrapper on init(). -
filterDestroyed
public void filterDestroyed()Called by each Coherence Filter wrapper on destroy(). -
shutdown
protected void shutdown()Shuts down the SessionHelper and any mess that it created. -
isClusterOwned
protected boolean isClusterOwned()Determine if the responsibility for shutting down the cluster is owned by the application.- Returns:
- true if the cluster software is running within the domain of the application context, false if within the domain of the application server
-
getShutdownDelayMillis
protected long getShutdownDelayMillis()Determine the number of milliseconds to defer shutdown after the app appears to have stopped.- Returns:
- the length of time in milliseconds to defer shutdown after the app is stopped
-
getServletContext
public javax.servlet.ServletContext getServletContext()Returns the Coherence ServletContext wrapper that this SessionHelper is helping with.- Returns:
- the Coherence ServletContext
-
getServletContextAttributeCache
Get the clustered attribute map.- Returns:
- the clustered attribute map, or null if the context does not cluster attributes
-
ensureServletContextAttributeCache
Get the clustered attribute map if it exists, otherwise create it (if the ServletContext is supposed to be clustered).- Returns:
- the clustered attribute map, or null if the context does not cluster attributes
-
shutdownServletContextAttributeCache
protected void shutdownServletContextAttributeCache()Shutdown the clustered attribute map. -
getServletContextMajorVersion
public int getServletContextMajorVersion()Returns the major version of the Java Servlet API that this servlet container supports.- Returns:
- the major version of the Java Servlet API that this servlet container supports
-
getServletContextMinorVersion
public int getServletContextMinorVersion()Returns the minor version of the Servlet API that this servlet container supports.- Returns:
- the minor version of the Servlet API that this servlet container supports
-
getWrappedServletContext
public javax.servlet.ServletContext getWrappedServletContext()Returns the application server's ServletContext that this SessionHelper is helping with.- Returns:
- the application server's ServletContext
-
isServletContextClustered
public boolean isServletContextClustered()Determine if the context clusters attributes.- Returns:
- true if the context clusters attributes; false otherwise
-
isStrict
public boolean isStrict()Determine if the Servlet specification is being followed strictly.- Returns:
- true if the Servlet specification is being followed strictly
-
parseString
Helper: Get a String init parameter from the context. The parsed init parameter will be stipped of leading and trailing whitespace. If the result is blank, the default will be returned.- Parameters:
ctx- the ServletContextsParam- the init parameter namesDefault- the default to return if the init parameter is not present or is blank- Returns:
- the specified init parameter, or if it is not present or it is blank, then the passed default
-
parseBoolean
public static boolean parseBoolean(javax.servlet.ServletContext ctx, String sParam, boolean fDefault) Helper: Get a boolean init parameter from the context.- Parameters:
ctx- the ServletContextsParam- the init parameter namefDefault- the default to return if the init parameter is not present or is not a boolean value- Returns:
- the specified boolean init parameter, or its default
-
parseInt
Helper: Get an int init parameter from the context.- Parameters:
ctx- the ServletContextsParam- the init parameter namenDefault- the default to return if the init parameter is not present or is not an int value- Returns:
- the specified int init parameter, or its default
-
getListeners
Get the application listeners.- Returns:
- a Listeners object containing all EventListener objects for the application
-
setListeners
Store the application listeners. This should only be called once.- Parameters:
listeners- a Listeners object containing all EventListener objects for the application
-
getContextAttributeListeners
Get the application listeners that listen to servlet context attribute events.- Returns:
- a Listeners object containing all EventListener objects for the application that implement ServletContextAttributeListener
-
addIgnoreAttributeName
Register a name to ignore events for.- Parameters:
sName- the name to ignore events for
-
removeIgnoreAttributeName
Unregister a name to ignore events for.- Parameters:
sName- the name to no longer ignore events for
-
isAttributeNameIgnored
Test to see if events for the specified name should be ignored.- Parameters:
sName- the name to test whether events are being ignored for- Returns:
trueif events for the specified name should be ignored
-
dispatchAttributeEvent
public void dispatchAttributeEvent(int nEvent, javax.servlet.ServletContextAttributeEvent evt) Dispatch a wrapped event to the application listeners.- Parameters:
nEvent- the internal enum that identifies the event nameevt- the application server's ServletContextAttributeEvent
-
dispatchInternalAttributeEvent
public void dispatchInternalAttributeEvent(int nEvent, javax.servlet.ServletContextAttributeEvent evt) Dispatch a wrapped event to the application listeners.- Parameters:
nEvent- the internal enum that identifies the event nameevt- the application server's ServletContextAttributeEvent
-
wrapFilterConfig
public javax.servlet.FilterConfig wrapFilterConfig(javax.servlet.FilterConfig cfg) Given the specified FilterConfig object, return a wrapper to use.- Parameters:
cfg- the container's FilterConfig object- Returns:
- a wrapper for the container's FilterConfig object
-
unwrapFilterConfig
public javax.servlet.FilterConfig unwrapFilterConfig(javax.servlet.FilterConfig cfg) Attempt to unwrap the passed FilterConfig wrapper to get the container's FilterConfig object back. Note: This does require that each Filter is configured with a different name.- Parameters:
cfg- the FilterConfig- Returns:
- the unwrapped FilterConfig object
-
filter
public void filter(javax.servlet.Filter filter, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp, javax.servlet.FilterChain chain) throws javax.servlet.ServletException, IOException Issue the service call to the specified servlet, given the passed request and response objects.- Parameters:
filter- the application's filter to invokereq- theServletRequestobject that contains the client's requestresp- theServletResponseobject that contains the servlet's responsechain- the FilterChain to use to invoke the next filter or the Servlet- Throws:
javax.servlet.ServletException- if servlet error occursIOException- if I/O error occurs
-
wrapServletConfig
public javax.servlet.ServletConfig wrapServletConfig(javax.servlet.ServletConfig cfg) Given the specified servlet config object, return a wrapper to use.- Parameters:
cfg- the container's servlet config object- Returns:
- a wrapper for the container's servlet config object
-
unwrapServletConfig
public javax.servlet.ServletConfig unwrapServletConfig(javax.servlet.ServletConfig cfg) Attempt to unwrap the passed ServletConfig wrapper to get the container's ServletConfig object back. Note: This does require that each servlet is configured with a different name.- Parameters:
cfg- the ServletConfig- Returns:
- the unwrapped ServletConfig object
-
isServletRequestWrapped
public boolean isServletRequestWrapped(javax.servlet.ServletRequest req) Test to see if the passed ServletRequest is wrapped, which means that invoking a method on the passed ServletRequest object will invoke the Coherence implementation, and will do so before the container implementation is invoked.- Parameters:
req- a ServletRequest object- Returns:
- true if the use of the passed ServletRequest object will result in the Coherence implementation will be invoked before the container implementation
-
wrapServletRequest
public javax.servlet.ServletRequest wrapServletRequest(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) Given the specified request, create a request wrapper.- Parameters:
req- a ServletRequest object that might need wrappingres- the associated ServletResponse- Returns:
- a request object that wraps the specified ServletRequest
-
unwrapServletRequest
public javax.servlet.ServletRequest unwrapServletRequest(javax.servlet.ServletRequest req) Fully unwrap the specified request object.- Parameters:
req- a ServletRequest object- Returns:
- the container's ServletRequest object
-
decodeCookie
Obtain a session ID from a request object by examining the cookies attached to the request.- Parameters:
req- an HttpServletRequest object that may have a session cookie attached to it- Returns:
- the HttpSession id as a String value, or null if no session id is found in a cookie attached to the request
-
encodeCookie
public void encodeCookie(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String sId, boolean fNew) Encode a session ID into a cookie and attach it to the response object.- Parameters:
req- the HttpServletRequest object for the current requestres- the HttpServletResponse object for the current request that the session cookie should be attached tosId- the session IDfNew- true if the session was just created
-
isSessionIdCookie
public boolean isSessionIdCookie(javax.servlet.http.Cookie cookie) Tests to see if the supplied cookie is a session ID cookie.- Parameters:
cookie- the cookie to test- Returns:
- true if the cookie is a session ID cookie
-
createRequestContext
public RequestContext createRequestContext(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) Given the specified request and response, provide a request context.- Parameters:
req- a ServletRequest object that might need wrapping or might have already been wrappedres- a ServletResponse object that might need wrapping or might have already been wrapped- Returns:
- the request context that matches the passed request and response objects
-
createServiceHelper
protected com.tangosol.coherence.servlet.ServiceHelper createServiceHelper()Create a ServiceHelper. This allows for example the use of a lazy strategy in obtaining the session.- Returns:
- the ServiceHelper
-
preService
public RequestContext preService(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException Wrap the passed request and response (if necessary) and build a request context that contains all the pertinent information about the request. This also touches the pre-existing session, if any, if this is the "point of initial entry" into the web container.- Parameters:
req- the servlet response object (could already be wrapped)res- the servlet response object (could already be wrapped)- Returns:
- a request context that contains all the information about this request that is being processed
- Throws:
javax.servlet.ServletException- if servlet error occursIOException- if I/O error occurs
-
postService
Finish the request processing after the servlet/jsp is complete. This includes marking the session (if new) as not new and releasing any locks.- Parameters:
ctx- the request context returned bypreService()- Throws:
javax.servlet.ServletException- if servlet error occursIOException- if I/O error occurs
-
service
public void service(javax.servlet.Servlet servlet, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, IOException Issue the service call to the specified servlet, given the passed request and response objects.- Parameters:
servlet- the servlet to invokereq- a ServletRequest object that might need wrapping or might have already been wrappedresp- might a ServletResponse object that might need wrapping or have already been wrapped- Throws:
javax.servlet.ServletException- if servlet error occursIOException- if I/O error occurs
-
instantiateHttpSessionCollection
Get the HttpSessionCollection object that manages the HttpSessionModel objects.- Returns:
- the HttpSessionCollection that manages the session models for the application
-
getHttpSessionCollection
Get the HttpSessionCollection object that manages the HttpSessionModel objects.- Returns:
- the HttpSessionCollection that manages the session models for the application
-
getHttpSessionMap
Get the map of session ID to session object for HttpSession objects managed in this application within this JVM/classloader.- Returns:
- the map of session IDs to HttpSession objects
-
removeHttpSessionFromMap
Remove the session object cached in the local session map.- Parameters:
sId- the session id
-
getLocalSessionIds
Gets session ids for all sessions that are in the local map, i.e. has been accessed by this node.- Returns:
- A Set of all local session ids.
-
createHttpSession
public javax.servlet.http.HttpSession createHttpSession()Create a new HttpSession object.- Returns:
- an HttpSession object
-
getHttpSession
Get the HttpSession object for the specified ID.- Parameters:
sId- the session ID- Returns:
- an HttpSession object, if it exists, or null
-
ensureHttpSession
Get the HttpSession object for the specified ID. A HttpSesion object will always be returned.- Parameters:
sId- the session ID- Returns:
- an HttpSession object
-
updateSessionId
Updates the session model id to a new session id. Used after authentication for security purposes in Servlet 3.1 compliant application containers.- Parameters:
sId- the session idsNewId- the new session id- Returns:
- the updated session id
-
getHttpSession
public javax.servlet.http.HttpSession getHttpSession(javax.servlet.http.HttpServletRequest req) Return the HttpSession associated with the given request.- Parameters:
req- the request- Returns:
- the current session associated with the given request or null if a session has not been associated with the request
-
onGetHttpSession
public void onGetHttpSession(javax.servlet.http.HttpServletRequest req) Allow service helper to perform actions on getSession calls. For example can be used for lazy fetching of session. Invoked by the framework at the beginning of aHttpServletRequest.getSession(boolean)method.- Parameters:
req- the request
-
setHttpSession
public void setHttpSession(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpSession session) Associate the supplied HttpSession with the given request.- Parameters:
req- the requestsession- the session to associate with the given request
-
isSessionContextEnabled
public boolean isSessionContextEnabled()Determine if the session context should disobey the deprecation and allow an application to enumerate sessions.- Returns:
- true if the session context should allow the application to enumerate sessions
-
getHttpSessionContext
public javax.servlet.http.HttpSessionContext getHttpSessionContext()Get the HttpSessionContext.- Returns:
- an HttpSessionContext object
-
isSessionIdCookieEnabled
public boolean isSessionIdCookieEnabled()Determine if a cookie may be used to hold the session ID.- Returns:
- true if a cookie may be used to hold the session ID
-
getSessionIdCookieName
Determine the name of the cookie for holding the session ID.- Returns:
- the name of the cookie for holding the session ID
-
getSessionIdCookieDomain
Determine the domain of the cookie for holding the session ID.- Returns:
- the domain of the cookie for holding the session ID
-
getSessionIdCookiePath
Determine the path of the cookie for holding the session ID.- Returns:
- the path of the cookie for holding the session ID
-
getSessionIdCookieMaxAge
public int getSessionIdCookieMaxAge()Determine the max age (in seconds) of the cookie for holding the session ID.- Returns:
- the max age of the cookie for holding the session ID
-
getSessionIdCookieSecure
public boolean getSessionIdCookieSecure()Determine if a web client will only send the session cookie over a SSL connection.- Returns:
- true if the client will only send the session cookie over a SSL connection
-
getSessionIdCookieHttpOnly
public boolean getSessionIdCookieHttpOnly()Determine if a web client will only send the session using the initial http/https connection.- Returns:
- true if the client will only send the session cookie using the initial http/https connection
-
isSessionIdEncodingEnabled
public boolean isSessionIdEncodingEnabled()Determine if URL encoding may be used to hold the session ID.- Returns:
- true if URL encoding may be used to hold the session ID
-
getSessionIdEncodingName
Determine the name of the URL parameter for session ID encoding and decoding.- Returns:
- the name of the URL parameter that contains the session id
-
isUseDefaultSessionIdDecoding
public boolean isUseDefaultSessionIdDecoding()Determine if the session ID decoding (from a URL) performed by the application server's request object is sufficient. Sometimes, it is necessary to use the application server's own decoding because it will "hide" the "jsessionid" parameter, making custom parsing impossible.- Returns:
- true to use the session ID provided by the application server's request object
-
isUseDefaultSessionIdEncoding
public boolean isUseDefaultSessionIdEncoding()Determine if the session ID encoding (into a URL) performed by the application server's response object is sufficient. This will be false for all known cases, since the container has no way of knowing the session ID of the custom session implementation.- Returns:
- true to use the app server to URL encode the session ID; false to use the custom implementation to encode it
-
getSessionIdAffinityToken
Retrieve the session id affinity suffix token if one is defined. The token along with all the characters to right of the token will be stripped off the session id.- Returns:
- the session id affinity token
-
isSessionIdReplaceAffinityToken
public boolean isSessionIdReplaceAffinityToken()If true, replace the session id affinity suffix token with the configured affinity token for this server.- Returns:
- true if the session affinity token should be replaced
-
decodeUrl
Decodes the session ID from the URL represented by the passed request.- Parameters:
request- the current HttpServletRequest- Returns:
- the session id if there were one encoded in the URL, otherwise null
-
decodeUri
-
encodeUrl
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.- Parameters:
sUrl- the URL to be encodedrequest- the current HttpServletRequest- Returns:
- the encoded URL if encoding is needed; the unchanged URL otherwise
-
encodeUrl
Encodes the specified URL by including the given session ID in it.- Parameters:
sUrl- the URL to be encodedsId- the session ID to encode in the URL- Returns:
- the encoded URL
-
enterSession
Obtain any necessary ownership for the specified session.If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
- Parameters:
sId- the session id
-
exitSession
Release ownership for the specified session. This method must be called exactly once for each call toenterSession(sId), with the only exceptions being:- If the session no longer exists, exit should not be called.
- If the session was created as part of the HTTP request processing,
this method must be invoked even though the corresponding
enterSession(sId)method was never invoked.
If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
- Parameters:
sId- the session idfNew- true if the session was just created
-
requestAsyncOwnership
Enter (obtain) and schedule an asynchronous call to exit (release) the specified session ID.- Parameters:
sId- the session ID to async enter and exit
-
shutdownHttpSessionCollection
public void shutdownHttpSessionCollection()Shutdown the http session collection. -
toString
Returns a string representation of the object. -
getConfigurationCache
Get the NamedCache used to store configuration and management information for the session management implementation.- Returns:
- the clustered cache used to store configuration and management information
-
ensureConfigurationCache
Get the NamedCache used to store configuration and management information for the session management implementation if it exists, otherwise create it.- Returns:
- the clustered cache used to store configuration and management information
-
shutdownConfigurationCache
protected void shutdownConfigurationCache()Shutdown the NamedCache used to store configuration and management information for the session management implementation. -
getDescription
Returns a string representation of this object's attributes.- Returns:
- a string representation of this object's attributes
-
getFactory
Determine the factory to use to instantiate container-specific implementations of the Servlet specification interfaces.- Returns:
- the factory used by the session helper
-
instantiateSessionReaperDaemon
Factory method: Instantiate a daemon thread that will clean up expired sessions.- Returns:
- the instantiated SessionReaperDaemon
-
getSessionReaperDaemon
Get the daemon thread that cleans up expired sessions.- Returns:
- the session reaper daemon, if it exists, otherwise null
-
getDaemonPriority
protected int getDaemonPriority()Determine the configured priority for the session reaper daemon.- Returns:
- the configured priority of the session reaper daemon
-
getDaemonCycleMillis
protected long getDaemonCycleMillis()Determine the number of milliseconds per reap cycle. This means that a new cycle will not start until this many milliseconds has passed since the previous cycle started.- Returns:
- the number of milliseconds per reap cycle
-
getDaemonCheckCollectionModulo
protected int getDaemonCheckCollectionModulo()Determine how many times the daemon will perform its check before checking the session models that the collection considers "local".- Returns:
- the modulo on which the daemon will check the session models that the collection considers "local"
-
isDaemonCheckCoordinated
protected boolean isDaemonCheckCoordinated()Determine if the reaper daemon coordinates the check across the cluster instead of just doing its own "local" scan.- Returns:
- true if the daemon coordinates a global scan with other nodes in the cluster
-
isDaemonAssumeLocality
protected boolean isDaemonAssumeLocality()Determine if the reaper daemon assumes that session data is stored only on nodes that are running the session reaper daemon thread.- Returns:
- true if the daemon can assume that all cluster nodes that store sessions are also running a reaper daemon
-
getWorkManagerMinThreads
protected int getWorkManagerMinThreads()Returns the minimum number of threads used by the work manager.- Returns:
- the minimum number of threads used by the work manager
-
getWorkManagerMaxThreads
protected int getWorkManagerMaxThreads()Returns the maximum number of threads used by the work manager.- Returns:
- the maximum number of threads used by the work manager
-
getWorkManager
Gets a WorkManager for use by the parallel reap task.- Returns:
- A WorkManager
-
getReapTaskFactory
protected com.tangosol.coherence.servlet.SessionHelper.ReapTaskFactory getReapTaskFactory()Getter for reap task factory.- Returns:
- The ReapTaskFactory
-
getSessionReapingMechanism
Returns the session reaping mechanism that is used in the application.- Returns:
- the session reaper mechanism that is used
-
logWarningIfRemoteDeleteMechanismConfigured
public void logWarningIfRemoteDeleteMechanismConfigured()Log the warning that session listener is being added even though the reaper mechanism used is RemoteDelete -
cleanUpSession
Does any addition clean up necessary for the deleted sessions. Session helpers can override this session and do any additional environment specific clean up. Used in 'RemoteDelete' reaping mechanism.- Parameters:
sessionId- the sessionId to be removed
-
checkForDeadSessions
protected void checkForDeadSessions()Discard the HttpSession objects that are no longer alive. -
killSession
Forcibly destroy a session. Use HttpSession invalidate method instead; this is only a last-ditch attempt to get rid of the session model when nothing else works.- Parameters:
sId- the session ID to destroy
-
shutdownSessionReaperDaemon
public void shutdownSessionReaperDaemon()Stop the daemon thread that is used for expiring sessions. -
instantiateSessionWorkerDaemon
Factory method: Instantiate a daemon thread that will be used for scheduled tasks.- Returns:
- a new session worker daemon, but without starting the thread
-
getSessionWorkerDaemon
Get the daemon thread that is used for scheduled tasks.- Returns:
- the session worker daemon, or null if it does not exist
-
setSessionWorkerDaemon
Set the daemon thread that is used for scheduled tasks.- Parameters:
daemon- the session worker daemon
-
ensureSessionWorkerDaemon
Get the daemon thread that is used for scheduled tasks, creating it if necessary.- Returns:
- the session worker daemon
-
shutdownSessionWorkerDaemon
public void shutdownSessionWorkerDaemon()Stop the daemon thread that is used for scheduled tasks. -
formatListeners
Format a Listeners object into a human readable string.- Parameters:
listeners- a Listeners object- Returns:
- a human readable description of the Listeners contents
-
formatCacheName
Format a NamedCache object into a human readable string.- Parameters:
cache- a NamedCache object- Returns:
- a human readable string describing the named cache
-
formatMapKeys
Format a map into a list of keys.- Parameters:
map- a Map object- Returns:
- a human readable list of keys from the Map
-
logEventException
Log an event exception.- Parameters:
e- the exceptionsMethod- the event method name etc.fContinue- true if the execution will be continued; false if the exception has to be logged and re-thrown
-
setIsReaperThread
public static void setIsReaperThread(boolean isReaperThread) -
unsetIsReaperThread
public static void unsetIsReaperThread() -
isReaperThread
public static boolean isReaperThread() -
isSyntheticSessionRemoveRequired
public static boolean isSyntheticSessionRemoveRequired()
-