atg.multisite
Class SiteContextPipelineServlet

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.multisite.SiteContextPipelineServlet
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class SiteContextPipelineServlet
extends InsertableServletImpl

This pipeline servlet is responsible for assigning a SiteContext object to the current thread.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
SiteContextPipelineServlet()
          Constructs an instanceof SiteContextPipelineServlet
 
Method Summary
protected  boolean disabledViaWebapp(DynamoHttpServletRequest pRequest)
          check to see if the associated web app for this request is configured to disable the use of SiteContext
 void doStartService()
          start the service.
 java.lang.String getContextParamEnableFlagName()
          get ContextParamEnableFlagName
 int getDefaultErrorCode()
          get DefaultErrorCode
 SiteContextRuleFilter getDefaultRuleFilter()
          get DefaultRuleFilter - this rule filter gets executed if no other rule filters sucessfully return a site ID
 InactiveSiteHandler getInactiveSiteHandler()
          get InactiveSiteHandler
 atg.service.preview.PreviewServletContextParams getPreviewServletContextParams()
          get PreviewServletContextParams
 SiteContextRuleFilter[] getRuleFilters()
          get RuleFilters - the array of components used to determine the site to use for this request
 SiteContextManager getSiteContextManager()
          get SiteContextManager
 SiteManager getSiteManager()
          get SiteManager
 java.lang.String getSiteSessionManagerPath()
          get SiteSessionManagerPath
protected  boolean handleSiteEnablement(SiteContext pSiteContext, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          deal with the site enablement logic
 boolean isEnabled()
          get Enabled
 boolean isOnPreviewServer()
          get OnPreviewServer
 boolean isUsePreviewContextParamForEnableFlag()
          get UsePreviewContextParamForEnableFlag
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          service method.
 void setContextParamEnableFlagName(java.lang.String pContextParamEnableFlagName)
          set ContextParamEnableFlagName
 void setDefaultErrorCode(int pDefaultErrorCode)
          set DefaultErrorCode
 void setDefaultRuleFilter(SiteContextRuleFilter pDefaultRuleFilter)
          set DefaultRuleFilter - this rule filter gets executed if no other rule filters sucessfully return a site ID
 void setEnabled(boolean pEnabled)
          set Enabled
 void setInactiveSiteHandler(InactiveSiteHandler pInactiveSiteHandler)
          set InactiveSiteHandler
 void setOnPreviewServer(boolean pOnPreviewServer)
          set OnPreviewServer
 void setPreviewServletContextParams(atg.service.preview.PreviewServletContextParams pPreviewServletContextParams)
          set PreviewServletContextParams
 void setRuleFilters(SiteContextRuleFilter[] pRuleFilters)
          set RuleFilters - the array of components used to determine the site to use for this request
 void setSiteContextManager(SiteContextManager pSiteContextManager)
          set SiteContextManager - the component that manages SiteContext objects
 void setSiteManager(SiteManager pSiteManager)
          set SiteManager
 void setSiteSessionManagerPath(java.lang.String pSiteSessionManagerPath)
          set SiteSessionManagerPath
 void setUsePreviewContextParamForEnableFlag(boolean pUsePreviewContextParamForEnableFlag)
          set UsePreviewContextParamForEnableFlag - if this is set to true then we will use the preview enable flag to determine if site context is enabled for the current web app.
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
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, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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
Class version string

Constructor Detail

SiteContextPipelineServlet

public SiteContextPipelineServlet()
Constructs an instanceof SiteContextPipelineServlet

Method Detail

setSiteContextManager

public void setSiteContextManager(SiteContextManager pSiteContextManager)
set SiteContextManager - the component that manages SiteContext objects

Parameters:
pSiteContextManager - the SiteContextManager

getSiteContextManager

public SiteContextManager getSiteContextManager()
get SiteContextManager

Returns:
the SiteContextManager - the component that manages SiteContext objects

setRuleFilters

public void setRuleFilters(SiteContextRuleFilter[] pRuleFilters)
set RuleFilters - the array of components used to determine the site to use for this request

Parameters:
pRuleFilters - the RuleFilters

getRuleFilters

public SiteContextRuleFilter[] getRuleFilters()
get RuleFilters - the array of components used to determine the site to use for this request

Returns:
the RuleFilters

setDefaultRuleFilter

public void setDefaultRuleFilter(SiteContextRuleFilter pDefaultRuleFilter)
set DefaultRuleFilter - this rule filter gets executed if no other rule filters sucessfully return a site ID

Parameters:
pDefaultRuleFilter - the DefaultRuleFilter

getDefaultRuleFilter

public SiteContextRuleFilter getDefaultRuleFilter()
get DefaultRuleFilter - this rule filter gets executed if no other rule filters sucessfully return a site ID

Returns:
the DefaultRuleFilter

setOnPreviewServer

public void setOnPreviewServer(boolean pOnPreviewServer)
set OnPreviewServer

Parameters:
pOnPreviewServer - the OnPreviewServer

isOnPreviewServer

public boolean isOnPreviewServer()
get OnPreviewServer

Returns:
the OnPreviewServer

setSiteSessionManagerPath

public void setSiteSessionManagerPath(java.lang.String pSiteSessionManagerPath)
set SiteSessionManagerPath

Parameters:
pSiteSessionManagerPath - the SiteSessionManagerPath

getSiteSessionManagerPath

public java.lang.String getSiteSessionManagerPath()
get SiteSessionManagerPath

Returns:
the SiteSessionManagerPath

setInactiveSiteHandler

public void setInactiveSiteHandler(InactiveSiteHandler pInactiveSiteHandler)
set InactiveSiteHandler

Parameters:
pInactiveSiteHandler - the InactiveSiteHandler

getInactiveSiteHandler

public InactiveSiteHandler getInactiveSiteHandler()
get InactiveSiteHandler

Returns:
the InactiveSiteHandler

setSiteManager

public void setSiteManager(SiteManager pSiteManager)
set SiteManager

Parameters:
pSiteManager - the SiteManager

getSiteManager

public SiteManager getSiteManager()
get SiteManager

Returns:
the SiteManager

setDefaultErrorCode

public void setDefaultErrorCode(int pDefaultErrorCode)
set DefaultErrorCode

Parameters:
pDefaultErrorCode - the DefaultErrorCode

getDefaultErrorCode

public int getDefaultErrorCode()
get DefaultErrorCode

Returns:
the DefaultErrorCode

setUsePreviewContextParamForEnableFlag

public void setUsePreviewContextParamForEnableFlag(boolean pUsePreviewContextParamForEnableFlag)
set UsePreviewContextParamForEnableFlag - if this is set to true then we will use the preview enable flag to determine if site context is enabled for the current web app. If the site context enabled flag is set in web.xml, then that value will override the preview value

Parameters:
pUsePreviewContextParamForEnableFlag - the UsePreviewContextParamForEnableFlag

isUsePreviewContextParamForEnableFlag

public boolean isUsePreviewContextParamForEnableFlag()
get UsePreviewContextParamForEnableFlag

Returns:
the UsePreviewContextParamForEnableFlag

setContextParamEnableFlagName

public void setContextParamEnableFlagName(java.lang.String pContextParamEnableFlagName)
set ContextParamEnableFlagName

Parameters:
pContextParamEnableFlagName - the ContextParamEnableFlagName

getContextParamEnableFlagName

public java.lang.String getContextParamEnableFlagName()
get ContextParamEnableFlagName

Returns:
the ContextParamEnableFlagName

setEnabled

public void setEnabled(boolean pEnabled)
set Enabled

Parameters:
pEnabled - the Enabled

isEnabled

public boolean isEnabled()
get Enabled

Returns:
the Enabled

setPreviewServletContextParams

public void setPreviewServletContextParams(atg.service.preview.PreviewServletContextParams pPreviewServletContextParams)
set PreviewServletContextParams

Parameters:
pPreviewServletContextParams - the PreviewServletContextParams

getPreviewServletContextParams

public atg.service.preview.PreviewServletContextParams getPreviewServletContextParams()
get PreviewServletContextParams

Returns:
the PreviewServletContextParams

doStartService

public void doStartService()
                    throws ServiceException
start the service. if the default error code has not been set, use 404

Overrides:
doStartService in class InsertableServletImpl
Throws:
ServiceException - if the Service had a problem starting up

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
service method. iterate through ruleFilters until a non-null SiteContext name is returned.
Call siteManager.getSite() to get a SiteContext object. Resolve the current SiteSession object and call siteContext.setSiteSession(siteSession). Then call siteSession.handleSiteRequest(). Finally call siteManager.pushSiteContext(siteContext) to set the SiteContext as the current SiteContext for this thread.

Overrides:
service in class PipelineableServletImpl
Parameters:
pRequest - the request object
pResponse - the response object
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

handleSiteEnablement

protected boolean handleSiteEnablement(SiteContext pSiteContext,
                                       DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
deal with the site enablement logic

Parameters:
pSiteContext - the site context for the request
pRequest - the Dynamo request object
pResponse - the Dynamo response object
Returns:
true if the calling process should keep processing or false if not

disabledViaWebapp

protected boolean disabledViaWebapp(DynamoHttpServletRequest pRequest)
check to see if the associated web app for this request is configured to disable the use of SiteContext

Parameters:
pRequest - the dynamo HttpServletRequest
Returns:
true if the web app is configured to disable the use of SiteContext, otherwise return false