atg.multisite
Class URLPatternMatchingRuleFilter

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.multisite.URLPatternMatchingRuleFilter
All Implemented Interfaces:
SiteContextRuleFilter, 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, java.util.EventListener

public class URLPatternMatchingRuleFilter
extends GenericService
implements SiteContextRuleFilter

The URLPatternMatchingRuleFilter firsts checks its URL map for a match, or a "startsWith" match against the current request's URL. If no match is found, then we ask the SiteURLManager for a match against the current request's URL.


Nested Class Summary
 class URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterAdminServlet
          admin servlet class
static interface URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar
          An interface for registering a URLPatternMatchingRuleFilter an another service when URLPatternMatchingRuleFilter comes up.
 
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
URLPatternMatchingRuleFilter()
          Constructs an instanceof URLPatternMatchingRuleFilter
 
Method Summary
protected  javax.servlet.Servlet createAdminServlet()
          create the admin servlet
protected  boolean disabledViaWebapp(DynamoHttpServletRequest pRequest)
          check to see if the associated web app for this request is configured to disable the pattern matching rule filter
 void doStartService()
          start the service
 java.lang.String filter(DynamoHttpServletRequest pRequest, SiteSessionManager pSiteSessionManager)
          get the URI from the request.
 javax.servlet.Servlet getAdminServlet()
          get the admin servlet
 java.lang.String getContextParamEnableFlagName()
          get ContextParamEnableFlagName
 SiteURLManager.OrderedSiteURLInfo getOrderedSiteURLInfo()
          get the ordered site url info
 java.lang.String getPatternMatchingURLForRequest(DynamoHttpServletRequest pRequest)
          get a URL for the request that is appropriate for use in the pattern matching algorithm
 URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar[] getRuleFilterRegistrars()
          Returns property ruleFilterRegistrars.
 java.lang.String getSiteIdForURL(java.lang.String pURL)
          get the site Id corresponding to the url
 SiteURLManager getSiteURLManager()
          get SiteURLManager
 java.util.Map<java.lang.String,java.lang.String> getURLs()
          get URLs
 boolean isEnabled()
          get Enabled
 boolean isEnableSimpleAlgorithm()
          get EnableSimpleAlgorithm
 boolean isEnableSiteURLManagerAlgorithm()
          get EnableSiteURLManagerAlgorithm
protected  void registerWithRegistrars()
          register ourselves with the SiteURLManagerAdminServlet
 void setContextParamEnableFlagName(java.lang.String pContextParamEnableFlagName)
          set ContextParamEnableFlagName
 void setEnabled(boolean pEnabled)
          set Enabled
 void setEnableSimpleAlgorithm(boolean pEnableSimpleAlgorithm)
          set EnableSimpleAlgorithm
 void setEnableSiteURLManagerAlgorithm(boolean pEnableSiteURLManagerAlgorithm)
          set EnableSiteURLManagerAlgorithm
 void setRuleFilterRegistrars(URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar[] pRuleFilterRegistrars)
          Sets property ruleFilterRegistrars.
 void setSiteURLManager(SiteURLManager pSiteURLManager)
          set SiteURLManager
 void setURLs(java.util.Map<java.lang.String,java.lang.String> pURLs)
          set URLs, also update the admin servlet
protected  void updateOrderedURLs()
          update the url map on the admin servlet
 
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
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

URLPatternMatchingRuleFilter

public URLPatternMatchingRuleFilter()
Constructs an instanceof URLPatternMatchingRuleFilter

Method Detail

setURLs

public void setURLs(java.util.Map<java.lang.String,java.lang.String> pURLs)
set URLs, also update the admin servlet

Parameters:
pURLs - the URLs

getURLs

public java.util.Map<java.lang.String,java.lang.String> getURLs()
get URLs

Returns:
the URLs

setEnabled

public void setEnabled(boolean pEnabled)
set Enabled

Parameters:
pEnabled - the Enabled

isEnabled

public boolean isEnabled()
get Enabled

Returns:
the Enabled

setSiteURLManager

public void setSiteURLManager(SiteURLManager pSiteURLManager)
set SiteURLManager

Parameters:
pSiteURLManager - the SiteURLManager

getSiteURLManager

public SiteURLManager getSiteURLManager()
get SiteURLManager

Returns:
the SiteURLManager

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

setEnableSimpleAlgorithm

public void setEnableSimpleAlgorithm(boolean pEnableSimpleAlgorithm)
set EnableSimpleAlgorithm

Parameters:
pEnableSimpleAlgorithm - the EnableSimpleAlgorithm

isEnableSimpleAlgorithm

public boolean isEnableSimpleAlgorithm()
get EnableSimpleAlgorithm

Returns:
the EnableSimpleAlgorithm

setEnableSiteURLManagerAlgorithm

public void setEnableSiteURLManagerAlgorithm(boolean pEnableSiteURLManagerAlgorithm)
set EnableSiteURLManagerAlgorithm

Parameters:
pEnableSiteURLManagerAlgorithm - the EnableSiteURLManagerAlgorithm

isEnableSiteURLManagerAlgorithm

public boolean isEnableSiteURLManagerAlgorithm()
get EnableSiteURLManagerAlgorithm

Returns:
the EnableSiteURLManagerAlgorithm

setRuleFilterRegistrars

public void setRuleFilterRegistrars(URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar[] pRuleFilterRegistrars)
Sets property ruleFilterRegistrars. Array of registrars to be notified when this component starts up.


getRuleFilterRegistrars

public URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar[] getRuleFilterRegistrars()
Returns property ruleFilterRegistrars. Array of registrars to be notified when this component starts up.


doStartService

public void doStartService()
                    throws ServiceException
start the service

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

registerWithRegistrars

protected void registerWithRegistrars()
register ourselves with the SiteURLManagerAdminServlet


updateOrderedURLs

protected void updateOrderedURLs()
update the url map on the admin servlet


getOrderedSiteURLInfo

public SiteURLManager.OrderedSiteURLInfo getOrderedSiteURLInfo()
get the ordered site url info

Returns:
an OrderedSiteURLInfo object containing the current ordered urls and url to site Id map

filter

public java.lang.String filter(DynamoHttpServletRequest pRequest,
                               SiteSessionManager pSiteSessionManager)
get the URI from the request. lookup the URI in the map. Find the corresponding Site Id. if none is found, then try asking the SiteURLManager for a match, if none is found then return null.

Specified by:
filter in interface SiteContextRuleFilter
Parameters:
pRequest - the request object
pSiteSessionManager - the site session manager for the current session
Returns:
the site Id, or null if no match was found

getPatternMatchingURLForRequest

public java.lang.String getPatternMatchingURLForRequest(DynamoHttpServletRequest pRequest)
get a URL for the request that is appropriate for use in the pattern matching algorithm

Parameters:
pRequest - the dynamo request
Returns:
the pattern matching url

getSiteIdForURL

public java.lang.String getSiteIdForURL(java.lang.String pURL)
get the site Id corresponding to the url

Parameters:
pURL - the url
Returns:
the site id that corresponds to the given url, or null if there is no site id mapped to the given url

disabledViaWebapp

protected boolean disabledViaWebapp(DynamoHttpServletRequest pRequest)
check to see if the associated web app for this request is configured to disable the pattern matching rule filter

Parameters:
pRequest - the dynamo HttpServletRequest
Returns:
true if the web app is configured to disable this rule filter, otherwise return false

getAdminServlet

public javax.servlet.Servlet getAdminServlet()
get the admin servlet

Specified by:
getAdminServlet in interface AdminableService
Overrides:
getAdminServlet in class GenericService
See Also:
GenericService.createAdminServlet()

createAdminServlet

protected javax.servlet.Servlet createAdminServlet()
create the admin servlet

Overrides:
createAdminServlet in class GenericService