atg.projects.b2bstore.servlet
Class WACheckSessionExpiration

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.servlet.pipeline.InsertableServletImpl
                      extended by atg.projects.b2bstore.servlet.CheckSessionExpiration
                          extended by atg.projects.b2bstore.servlet.WACheckSessionExpiration
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class WACheckSessionExpiration
extends CheckSessionExpiration

A subclass of the CheckSessionExpiration servlet that is aware of web applications and context root issues. Rather than specifying the absolute URL to test for expired sessions and the absolute URL to redirect to when an expired session is detected, this subclass lets you specify URL's relative to the web application's context root and converts these to absolute URL's at runtime. It can therefore detect expired sessions for a web application no matter where that web application is deployed.

To use this servlet you must specify the following properties:

insertAfterServlet
Specifies where in the servlet pipeline to insert this servlet.

webAppRegistry
Specifies the Dynamo web application registry where the web app is registered.

webApplicationName
Specifies the name by which this web application is known to the registry

relativeExpirationPath
Specifies the root path of URL's that should check for session expiration, relative to the web app context root

relativeExpirationURL
Specifies the URL to redirect to if an expired session is seen, relative to the web app context root

See Also:
CheckSessionExpiration

Field Summary
static java.lang.String CLASS_VERSION
           
static java.lang.String MY_RESOURCE_NAME
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
WACheckSessionExpiration()
           
 
Method Summary
protected  void constructPaths()
          Convert relativeExpirationPath and relativeExpirationURL to absolute values, taking into account the Web application's context root, and call the superclass methods to set the corresponding superclass properties.
protected  java.lang.String errorMsg(java.lang.String pResourceKey)
          Get a formatted error message string based on an error message resource key.
protected  java.lang.String errorMsg(java.lang.String pResourceKey, java.lang.Object pArg)
          Get a formatted error message string based on an error message resource key and a single message argument.
protected  java.lang.String errorMsg(java.lang.String pResourceKey, java.lang.Object[] pArgs)
          Get a formatted error message string based on an error message resource key and an array of message arguments.
 java.lang.String getRelativeExpirationPath()
          Return the root, relative to the web application's context path, of the URL's that should be checked for session expiration.
 java.lang.String getRelativeExpirationURL()
          Return the URL, relative to the web application's context path, that we should redirect to if an expired session is seen.
 java.lang.String getWebApplicationName()
          Return the name by this web applicaiton is known to the web application registry.
 WebAppRegistry getWebAppRegistry()
          Return the Dynamo Web Application Registry that knows about the web application whose URL's we are checking for session expiration.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Examine the current request to see if the URL matches the criteria for detecting expired sessions and if the session has actually expired, and redirect to a specified URL if necessary.
 void setRelativeExpirationPath(java.lang.String pRelativeExpirationPath)
          Specify the root, relative to the web application's context path, of the URL's that should be checked for session expiration.
 void setRelativeExpirationURL(java.lang.String pRelativeExpirationURL)
          Specify the URL, relative to the web application's context path, that we should redirect to if an expired session is seen.
 void setWebApplicationName(java.lang.String pWebApplicationName)
          Specify the name by this web applicaiton is known to the web application registry.
 void setWebAppRegistry(WebAppRegistry pWebAppRegistry)
          Specify the Dynamo Web Application Registry that knows about the web application whose URL's we are checking for session expiration.
 
Methods inherited from class atg.projects.b2bstore.servlet.CheckSessionExpiration
getExpirationURL, getSessionExpirationPath, setExpirationURL, setSessionExpirationPath
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
doStartService, getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.servlet.pipeline.PipelineableServlet
getNextServlet, passRequest, setNextServlet
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

MY_RESOURCE_NAME

public static final java.lang.String MY_RESOURCE_NAME
See Also:
Constant Field Values
Constructor Detail

WACheckSessionExpiration

public WACheckSessionExpiration()
Method Detail

setWebAppRegistry

public void setWebAppRegistry(WebAppRegistry pWebAppRegistry)
Specify the Dynamo Web Application Registry that knows about the web application whose URL's we are checking for session expiration.


getWebAppRegistry

public WebAppRegistry getWebAppRegistry()
Return the Dynamo Web Application Registry that knows about the web application whose URL's we are checking for session expiration.


setWebApplicationName

public void setWebApplicationName(java.lang.String pWebApplicationName)
Specify the name by this web applicaiton is known to the web application registry.


getWebApplicationName

public java.lang.String getWebApplicationName()
Return the name by this web applicaiton is known to the web application registry.


setRelativeExpirationPath

public void setRelativeExpirationPath(java.lang.String pRelativeExpirationPath)
Specify the root, relative to the web application's context path, of the URL's that should be checked for session expiration. This value is used to set the sessionExpirationPath property in the base class by prepending the web app's context root to the value of relativeExpirationPath.


getRelativeExpirationPath

public java.lang.String getRelativeExpirationPath()
Return the root, relative to the web application's context path, of the URL's that should be checked for session expiration.


setRelativeExpirationURL

public void setRelativeExpirationURL(java.lang.String pRelativeExpirationURL)
Specify the URL, relative to the web application's context path, that we should redirect to if an expired session is seen. This value is used to set the expirationURL property in the base class by prepending the web app's context root to the value of relativeExpirationURL.


getRelativeExpirationURL

public java.lang.String getRelativeExpirationURL()
Return the URL, relative to the web application's context path, that we should redirect to if an expired session is seen.


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
Examine the current request to see if the URL matches the criteria for detecting expired sessions and if the session has actually expired, and redirect to a specified URL if necessary.

This method simply converts the relative expiration path and expiration URL properties to absolute URL's (if necessary) and then calls the superclass service method to detect and handle expired sessions.

Overrides:
service in class CheckSessionExpiration
Throws:
java.io.IOException - if an error occurred while reading or writing the servlet request
javax.servlet.ServletException - if an error occurred while processing the servlet request

constructPaths

protected void constructPaths()
                       throws javax.servlet.ServletException
Convert relativeExpirationPath and relativeExpirationURL to absolute values, taking into account the Web application's context root, and call the superclass methods to set the corresponding superclass properties.

Throws:
javax.servlet.ServletException

errorMsg

protected java.lang.String errorMsg(java.lang.String pResourceKey)
Get a formatted error message string based on an error message resource key.


errorMsg

protected java.lang.String errorMsg(java.lang.String pResourceKey,
                                    java.lang.Object pArg)
Get a formatted error message string based on an error message resource key and a single message argument.


errorMsg

protected java.lang.String errorMsg(java.lang.String pResourceKey,
                                    java.lang.Object[] pArgs)
Get a formatted error message string based on an error message resource key and an array of message arguments.