atg.multisite
Class SiteURLManager

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

public class SiteURLManager
extends GenericService
implements atg.multisite.MultisiteSnapshotDeploymentHandler, PropertiesChangedListener, URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar

The SiteURLManager is responsible for determining the site Id for a given request URL, as well as determining the base URL for a given site Id.


Nested Class Summary
 class SiteURLManager.OrderedSiteURLInfo
          ordered set of urls and the corresponding map of urls to site ids
 class SiteURLManager.SiteDeterminationURL
          An object that contains the site id and the part of the URL that was used to determine the site.
 class SiteURLManager.SiteURLComparator
          a comparator to sort URLs using the following priority: 1.
 
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
SiteURLManager()
          Constructs an instanceof SiteURLManager
 
Method Summary
protected  void addQueryParams(java.lang.StringBuffer pURLBuffer, java.lang.String pQueryParams)
          Adds query parameters to a URL StringBuffer.
protected  void addStickySite(java.lang.StringBuffer pURLBuffer, java.lang.String pSiteId)
          Adds the stickySite and pushSite query parameters to a URL StringBuffer.
protected  void appendSlashIfNeeded(java.lang.StringBuffer pURLBuffer)
          Adds a slash to the end if there isn't one already.
protected  javax.servlet.Servlet createAdminServlet()
          create the admin servlet
 void createURLMaps()
          create the url maps
protected  void disableSite(java.lang.String pSiteId)
          change a site to be disabled
 void doStartService()
          start service
protected  java.lang.String encodeURL(DynamoHttpServletRequest pRequest, java.lang.String pURL)
          Encodes the URL by calling DynamoHttpServletRequest.encodeURL(String).
protected  java.lang.String encodeURL(DynamoHttpServletRequest pRequest, java.lang.String pURL, boolean pUseReverseMap)
          Encodes the URL by calling DynamoHttpServletRequest.encodeURL(String).
protected  int findLevelEnd(java.lang.String pURL, int pLevelStartIndex)
          get the index of the level end in the passed-in url
protected  int findLevelStart(java.lang.String pURL, int pLevel)
          get the index of the level start in the passed-in url
 java.lang.String getAdditionalProductionURLPropertyName()
          get AdditionalProductionURLPropertyName
 javax.servlet.Servlet getAdminServlet()
          Returns the Servlet that will handle requests directed at this service.
protected  java.lang.String getCurrentRequestURL(DynamoHttpServletRequest pRequest, boolean pInInclude)
          Gets the current request URL.
 java.lang.String getDefaultProtocol()
          Gets the defaultProtocol to use for absolute URL generation
 SiteURLManager.OrderedSiteURLInfo getOrderedSiteURLInfo()
          get the ordered site url info
 java.util.Set<java.lang.String> getOrderedURLs()
          get a sorted set of all the URLs
 java.lang.String getProductionSiteBaseURL(DynamoHttpServletRequest pRequest, java.lang.String pSiteId, java.lang.String pPath, java.lang.String pQueryParams, java.lang.String pProtocol, boolean pInInclude)
          Return the Production Site Base URL for the site that corresponds to pSiteId.
 java.lang.String getProductionSiteBaseURL(java.lang.String pSiteId, java.lang.String pPath, java.lang.String pQueryParams, java.lang.String pProtocol, boolean pInInclude)
          Return the Production Site Base URL for the site that corresponds to pSiteId.
 java.lang.String getProductionURLPropertyName()
          get ProductionURLPropertyName
 ProfileRealmManager getProfileRealmManager()
          get ProfileRealmManager
 PushedSiteParamFilter getPushedSiteParamFilter()
          get PushedSiteParamFilter
 atg.multisite.ScenarioManagerServiceProxy getScenarioManagerServiceProxy()
          get ScenarioManagerServiceProxy
 atg.multisite.SiteBaseURLProcessor[] getSiteBaseURLProcessors()
          Gets the array of SiteBaseURLPRocessors
 java.lang.String getSiteIdForURL(java.lang.String pURL)
          Given a URL string, determine the corresponding site ID.
 java.lang.String getSiteIdForURL(java.lang.String pURL, java.util.Map<java.lang.String,java.lang.String> pMap)
          generic method to get a site id given a URL and a map of URLs to site Ids
 SiteManager getSiteManager()
          get SiteManager
 SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL)
           
 SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL, java.util.Map<java.lang.String,java.lang.String> pMap)
           
 atg.xml.XMLFile getTransformFile()
          get TransformFile
 float getUrlCachePercentageFull()
          Gets the percentage of the URL Cache that is used.
 int getUrlCacheSize()
          Gets the size of the URL cache
 atg.xml.tools.XMLToDOMParser getXMLToDOMParser()
          get XMLToDOMParser
 atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
          get XMLToolsFactory
 void handleMultisiteChangeEvent(java.lang.String pDeploymentId)
          react to a deployment event
 boolean isAutoAppendStickySiteParams()
          get AutoAppendStickySiteParams
 boolean isEnableURLTransform()
          get EnableURLTransform
 boolean isRebuildURLMapsOnPropertiesChangedEvents()
          get RebuildURLMapsOnPropertiesChangedEvents
 boolean isSuppressDuplicateURLWarnings()
          get SuppressDuplicateURLWarnings
 java.lang.String lowercaseDomainName(java.lang.String pURL)
          lowercase the domain name portion of a url
protected  boolean parseTransformFile()
          read in the transform file
protected  void processPropChangeEventForRealmCheck(PropertiesChangedEvent pEvent)
          if an update or insert event comes in for a site, and the site's realm id property has changed, then check to make sure the realm id property is valid, if not then disable the site.
protected  void processSingleURL(java.lang.String pURL, java.lang.String pSiteId, java.util.Map<java.lang.String,java.lang.String> pMapURLToSite, java.util.Set<java.lang.String> pURLsToRemove)
          process a single URL
protected  java.lang.String processSiteBaseURL(java.lang.String pURL)
          Executes all of the configured siteBaseURLProcessors on the Site's base URL.
 void propertiesChanged(PropertiesChangedEvent pEvent)
          react to a properties changed event.
protected  void registerAsPropertyChangedListener()
          register this class as a property changed event listener
 void registerRuleFilter(URLPatternMatchingRuleFilter pFilter)
          Register the specified URLPatternMatchingRuleFilter.
protected  java.lang.String removeAfterLastSlash(java.lang.String pURL)
          Removes the string after the last slash.
protected  java.lang.String removeBeforeFirstSlash(java.lang.String pURL)
          Removes all text before the first slash
protected  java.lang.String removeSiteDeterminationPath(java.lang.String pURL)
          Removes the site determination part of the url
protected  java.lang.String removeStandardPorts(java.lang.String pURL)
          Removes ":80" and ":443" from a string
protected  java.lang.String removeTrailingSlash(java.lang.String pURL)
          Removes the last character if it is a slash.
 void setAdditionalProductionURLPropertyName(java.lang.String pAdditionalProductionURLPropertyName)
          set AdditionalProductionURLPropertyName
 void setAutoAppendStickySiteParams(boolean pAutoAppendStickySiteParams)
          set AutoAppendStickySiteParams
 void setDefaultProtocol(java.lang.String pDefaultProtocol)
          Sets the defaultProtocol to use for absolute URL generation
 void setEnableURLTransform(boolean pEnableURLTransform)
          set EnableURLTransform
 void setProductionURLPropertyName(java.lang.String pProductionURLPropertyName)
          set ProductionURLPropertyName
 void setProfileRealmManager(ProfileRealmManager pProfileRealmManager)
          set ProfileRealmManager
 void setPushedSiteParamFilter(PushedSiteParamFilter pPushedSiteParamFilter)
          set PushedSiteParamFilter
 void setRebuildURLMapsOnPropertiesChangedEvents(boolean pRebuildURLMapsOnPropertiesChangedEvents)
          set RebuildURLMapsOnPropertiesChangedEvents
 void setScenarioManagerServiceProxy(atg.multisite.ScenarioManagerServiceProxy pScenarioManagerServiceProxy)
          set ScenarioManagerServiceProxy
 void setSiteBaseURLProcessors(atg.multisite.SiteBaseURLProcessor[] pSiteBaseURLProcessors)
          Sets the array of SiteBaseURLProcessors
 void setSiteManager(SiteManager pSiteManager)
          set SiteManager
 void setSuppressDuplicateURLWarnings(boolean pSuppressDuplicateURLWarnings)
          set SuppressDuplicateURLWarnings
 void setTransformFile(atg.xml.XMLFile pTransformFile)
          set TransformFile
 void setUrlCacheSize(int pUrlCacheSize)
          Sets the size of the URL cache
 void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pXMLToolsFactory)
          set XMLToolsFactory
protected  java.util.Map<java.lang.String,java.lang.String> transformProductionURLS(RepositoryItem[] pSites)
          transform the production URLs using the transform rule
protected  java.lang.String transformURL(java.lang.String pURL)
          transform a url
protected  java.lang.String trimLevel(java.lang.String pURI)
          trim one directory level off the URI
 
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

SiteURLManager

public SiteURLManager()
Constructs an instanceof SiteURLManager

Method Detail

setSiteManager

public void setSiteManager(SiteManager pSiteManager)
set SiteManager

Parameters:
pSiteManager - the SiteManager

getSiteManager

public SiteManager getSiteManager()
get SiteManager

Returns:
the SiteManager

setProfileRealmManager

public void setProfileRealmManager(ProfileRealmManager pProfileRealmManager)
set ProfileRealmManager

Parameters:
pProfileRealmManager - the ProfileRealmManager

getProfileRealmManager

public ProfileRealmManager getProfileRealmManager()
get ProfileRealmManager

Returns:
the ProfileRealmManager

setScenarioManagerServiceProxy

public void setScenarioManagerServiceProxy(atg.multisite.ScenarioManagerServiceProxy pScenarioManagerServiceProxy)
set ScenarioManagerServiceProxy

Parameters:
pScenarioManagerServiceProxy - the ScenarioManagerServiceProxy

getScenarioManagerServiceProxy

public atg.multisite.ScenarioManagerServiceProxy getScenarioManagerServiceProxy()
get ScenarioManagerServiceProxy

Returns:
the ScenarioManagerServiceProxy

getUrlCacheSize

public int getUrlCacheSize()
Gets the size of the URL cache

Returns:
the urlCacheSize

setUrlCacheSize

public void setUrlCacheSize(int pUrlCacheSize)
Sets the size of the URL cache

Parameters:
pUrlCacheSize - the urlCacheSize to set

getUrlCachePercentageFull

public float getUrlCachePercentageFull()
Gets the percentage of the URL Cache that is used. This is calculated by dividing current size by maximum size.

Returns:
The percentage that is used.

setProductionURLPropertyName

public void setProductionURLPropertyName(java.lang.String pProductionURLPropertyName)
set ProductionURLPropertyName

Parameters:
pProductionURLPropertyName - the ProductionURLPropertyName

getProductionURLPropertyName

public java.lang.String getProductionURLPropertyName()
get ProductionURLPropertyName

Returns:
the ProductionURLPropertyName

setAdditionalProductionURLPropertyName

public void setAdditionalProductionURLPropertyName(java.lang.String pAdditionalProductionURLPropertyName)
set AdditionalProductionURLPropertyName

Parameters:
pAdditionalProductionURLPropertyName - the AdditionalProductionURLPropertyName

getAdditionalProductionURLPropertyName

public java.lang.String getAdditionalProductionURLPropertyName()
get AdditionalProductionURLPropertyName

Returns:
the AdditionalProductionURLPropertyName

setAutoAppendStickySiteParams

public void setAutoAppendStickySiteParams(boolean pAutoAppendStickySiteParams)
set AutoAppendStickySiteParams

Parameters:
pAutoAppendStickySiteParams - the AutoAppendStickySiteParams

isAutoAppendStickySiteParams

public boolean isAutoAppendStickySiteParams()
get AutoAppendStickySiteParams

Returns:
the AutoAppendStickySiteParams

setPushedSiteParamFilter

public void setPushedSiteParamFilter(PushedSiteParamFilter pPushedSiteParamFilter)
set PushedSiteParamFilter

Parameters:
pPushedSiteParamFilter - the PushedSiteParamFilter

getPushedSiteParamFilter

public PushedSiteParamFilter getPushedSiteParamFilter()
get PushedSiteParamFilter

Returns:
the PushedSiteParamFilter

setTransformFile

public void setTransformFile(atg.xml.XMLFile pTransformFile)
set TransformFile

Parameters:
pTransformFile - the TransformFile

getTransformFile

public atg.xml.XMLFile getTransformFile()
get TransformFile

Returns:
the TransformFile

setXMLToolsFactory

public void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pXMLToolsFactory)
set XMLToolsFactory

Parameters:
pXMLToolsFactory - the XMLToolsFactory

getXMLToolsFactory

public atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
get XMLToolsFactory

Returns:
the XMLToolsFactory

getXMLToDOMParser

public atg.xml.tools.XMLToDOMParser getXMLToDOMParser()
get XMLToDOMParser

Returns:
the XMLToDOMParser

setRebuildURLMapsOnPropertiesChangedEvents

public void setRebuildURLMapsOnPropertiesChangedEvents(boolean pRebuildURLMapsOnPropertiesChangedEvents)
set RebuildURLMapsOnPropertiesChangedEvents

Parameters:
pRebuildURLMapsOnPropertiesChangedEvents - the RebuildURLMapsOnPropertiesChangedEvents

isRebuildURLMapsOnPropertiesChangedEvents

public boolean isRebuildURLMapsOnPropertiesChangedEvents()
get RebuildURLMapsOnPropertiesChangedEvents

Returns:
the RebuildURLMapsOnPropertiesChangedEvents

setDefaultProtocol

public void setDefaultProtocol(java.lang.String pDefaultProtocol)
Sets the defaultProtocol to use for absolute URL generation

Parameters:
pDefaultProtocol - The default protocol

getDefaultProtocol

public java.lang.String getDefaultProtocol()
Gets the defaultProtocol to use for absolute URL generation

Returns:
The default protocol

setSuppressDuplicateURLWarnings

public void setSuppressDuplicateURLWarnings(boolean pSuppressDuplicateURLWarnings)
set SuppressDuplicateURLWarnings

Parameters:
pSuppressDuplicateURLWarnings - the SuppressDuplicateURLWarnings

isSuppressDuplicateURLWarnings

public boolean isSuppressDuplicateURLWarnings()
get SuppressDuplicateURLWarnings

Returns:
the SuppressDuplicateURLWarnings

getSiteBaseURLProcessors

public atg.multisite.SiteBaseURLProcessor[] getSiteBaseURLProcessors()
Gets the array of SiteBaseURLPRocessors

Returns:
the siteBaseURLProcessors

setSiteBaseURLProcessors

public void setSiteBaseURLProcessors(atg.multisite.SiteBaseURLProcessor[] pSiteBaseURLProcessors)
Sets the array of SiteBaseURLProcessors

Parameters:
pSiteBaseURLProcessors - the siteBaseURLProcessors to set

setEnableURLTransform

public void setEnableURLTransform(boolean pEnableURLTransform)
set EnableURLTransform

Parameters:
pEnableURLTransform - the EnableURLTransform

isEnableURLTransform

public boolean isEnableURLTransform()
get EnableURLTransform

Returns:
the EnableURLTransform

doStartService

public void doStartService()
                    throws ServiceException
start service

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

getSiteIdForURL

public java.lang.String getSiteIdForURL(java.lang.String pURL)
Given a URL string, determine the corresponding site ID. The algorithm for determining the site ID examines the configured and generated URLs for all sites, selects the URL that best matches pURL, and returns the site ID that corresponds to that URL.

Parameters:
pURL - the request URL for which a matching site ID needs to be found
Returns:
the site ID matching pURL

getSiteURLForURL

public SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL)

getSiteIdForURL

public java.lang.String getSiteIdForURL(java.lang.String pURL,
                                        java.util.Map<java.lang.String,java.lang.String> pMap)
generic method to get a site id given a URL and a map of URLs to site Ids

Parameters:
pURL - the url
pMap - the map of URLs to site Ids
Returns:
the site Id that corresponds to pURL

getSiteURLForURL

public SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL,
                                                            java.util.Map<java.lang.String,java.lang.String> pMap)

getOrderedURLs

public java.util.Set<java.lang.String> getOrderedURLs()
get a sorted set of all the URLs

Returns:
a SortedSet of URLs

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

trimLevel

protected java.lang.String trimLevel(java.lang.String pURI)
trim one directory level off the URI


addStickySite

protected void addStickySite(java.lang.StringBuffer pURLBuffer,
                             java.lang.String pSiteId)
Adds the stickySite and pushSite query parameters to a URL StringBuffer.

Parameters:
pURLBuffer - The StringBuffer to add the query params to
pSiteId - The Site ID to push

addQueryParams

protected void addQueryParams(java.lang.StringBuffer pURLBuffer,
                              java.lang.String pQueryParams)
Adds query parameters to a URL StringBuffer.

Parameters:
pURLBuffer - The URL StringBuffer to add the query params to
pQueryParams - The query params to add

removeAfterLastSlash

protected java.lang.String removeAfterLastSlash(java.lang.String pURL)
Removes the string after the last slash.

Parameters:
pURL - The URL to trim
Returns:
The trimed URL string

removeSiteDeterminationPath

protected java.lang.String removeSiteDeterminationPath(java.lang.String pURL)
Removes the site determination part of the url

Parameters:
pURL - The url
Returns:
The url with the site determination part removed

removeBeforeFirstSlash

protected java.lang.String removeBeforeFirstSlash(java.lang.String pURL)
Removes all text before the first slash

Parameters:
pURL - The URL string to trim
Returns:
The trimmed URL string

appendSlashIfNeeded

protected void appendSlashIfNeeded(java.lang.StringBuffer pURLBuffer)
Adds a slash to the end if there isn't one already.

Parameters:
pURLBuffer - The URL buffer

removeTrailingSlash

protected java.lang.String removeTrailingSlash(java.lang.String pURL)
Removes the last character if it is a slash.

Parameters:
pURL - The url to remove the slash from.
Returns:
The url with the trailing slash removed it exists.

removeStandardPorts

protected java.lang.String removeStandardPorts(java.lang.String pURL)
Removes ":80" and ":443" from a string

Parameters:
pURL - The string to remove from
Returns:
The string with ports removed

getCurrentRequestURL

protected java.lang.String getCurrentRequestURL(DynamoHttpServletRequest pRequest,
                                                boolean pInInclude)
Gets the current request URL.

Parameters:
pRequest - The current request. Returns an empty string if null.
pInInclude - If the url should use the path of the include.
Returns:
The current request's URL.

getProductionSiteBaseURL

public java.lang.String getProductionSiteBaseURL(java.lang.String pSiteId,
                                                 java.lang.String pPath,
                                                 java.lang.String pQueryParams,
                                                 java.lang.String pProtocol,
                                                 boolean pInInclude)
Return the Production Site Base URL for the site that corresponds to pSiteId. The Production Site Base URL can be either the value stored in the site's repository item, or it can be the generated URL if a URL transform rule was applied. If the SiteURLManager is running on a preview server then the pSiteId value is added as a site_id param. If the site's base URL starts with a slash, it will be treated as a context root. Otherwise it will be treated as a domain name. Domain based URLs will have the protocol prepended. ServletUtil.getCurrentRequest() will be used for determining the current request. If pPath starts with a slash, it will be treated as relative to the base url. If pPath doesn't start with a slash, it will be treated as relative to the current requests path. If pInInclude is true, relative paths will be relative to the included pages path, instead of the current requests path.

Parameters:
pSiteId - the Id of the Site for which the production site base URL should be found
pPath - optional path string that will be included in the returned URL
pQueryParams - optional additional query params that will be included in the returned URL. This method will ensure that the query params are properly formed with the addition of a possible site_id param
pProtocol - optional protocol to use for absolute urls. If null defaultProtocol will be used
pInInclude - if relative paths should use the URI of the included page.
Returns:
the Production Site Base URL that corresponds to pSiteID with additional path and query params included, or null if there is no Site that corresponds to the passed in pSiteId

getProductionSiteBaseURL

public java.lang.String getProductionSiteBaseURL(DynamoHttpServletRequest pRequest,
                                                 java.lang.String pSiteId,
                                                 java.lang.String pPath,
                                                 java.lang.String pQueryParams,
                                                 java.lang.String pProtocol,
                                                 boolean pInInclude)
Return the Production Site Base URL for the site that corresponds to pSiteId. The Production Site Base URL can be either the value stored in the site's repository item, or it can be the generated URL if a URL transform rule was applied. If the SiteURLManager is running on a preview server then the pSiteId value is added as a site_id param. If the site's base URL starts with a slash, it will be treated as a context root. Otherwise it will be treated as a domain name. Domain based URLs will have the protocol prepended. If pPath starts with a slash, it will be treated as relative to the base url. If pPath doesn't start with a slash, it will be treated as relative to the current requests path. If pInInclude is true, relative paths will be relative to the included pages path, instead of the current requests path.

Parameters:
pRequest - The current request.
pSiteId - the Id of the Site for which the production site base URL should be found
pPath - optional path string that will be included in the returned URL
pQueryParams - optional additional query params that will be included in the returned URL. This method will ensure that the query params are properly formed with the addition of a possible site_id param
pProtocol - optional protocol to use for absolute urls. If null defaultProtocol will be used
pInInclude - if relative paths should use the URI of the included page.
Returns:
the Production Site Base URL that corresponds to pSiteID with additional path and query params included, or null if there is no Site that corresponds to the passed in pSiteId

processSiteBaseURL

protected java.lang.String processSiteBaseURL(java.lang.String pURL)
Executes all of the configured siteBaseURLProcessors on the Site's base URL.

Parameters:
pURL - The Site's base URL.
Returns:
The URL after it has been processed by of the siteBaseURLProcessors

encodeURL

protected java.lang.String encodeURL(DynamoHttpServletRequest pRequest,
                                     java.lang.String pURL)
Encodes the URL by calling DynamoHttpServletRequest.encodeURL(String).

Parameters:
pRequest - The current request. If null, the URL is returned unmodified.
pURL - The URL to encode
pUseReverseMap - whether or not the encode method should use the reverse mapping for context roots to correct the URL for use with VCRs
Returns:
The encoded URL.

encodeURL

protected java.lang.String encodeURL(DynamoHttpServletRequest pRequest,
                                     java.lang.String pURL,
                                     boolean pUseReverseMap)
Encodes the URL by calling DynamoHttpServletRequest.encodeURL(String).

Parameters:
pRequest - The current request. If null, the URL is returned unmodified.
pURL - The URL to encode
Returns:
The encoded URL.

registerAsPropertyChangedListener

protected void registerAsPropertyChangedListener()
register this class as a property changed event listener


propertiesChanged

public void propertiesChanged(PropertiesChangedEvent pEvent)
react to a properties changed event. this will get called every time a site configuration item is modified.

Specified by:
propertiesChanged in interface PropertiesChangedListener
Parameters:
pEvent - the properties changed event

processPropChangeEventForRealmCheck

protected void processPropChangeEventForRealmCheck(PropertiesChangedEvent pEvent)
if an update or insert event comes in for a site, and the site's realm id property has changed, then check to make sure the realm id property is valid, if not then disable the site. only do this if we're on the process editor server, since we don't want every server on the cluster doing the update

Parameters:
pEvent - the properties changed event

disableSite

protected void disableSite(java.lang.String pSiteId)
change a site to be disabled

Parameters:
pSiteId - the id of the site to disable

handleMultisiteChangeEvent

public void handleMultisiteChangeEvent(java.lang.String pDeploymentId)
react to a deployment event

Specified by:
handleMultisiteChangeEvent in interface atg.multisite.MultisiteSnapshotDeploymentHandler
Parameters:
pDeploymentId - the id of the new deployment

createURLMaps

public void createURLMaps()
create the url maps


processSingleURL

protected void processSingleURL(java.lang.String pURL,
                                java.lang.String pSiteId,
                                java.util.Map<java.lang.String,java.lang.String> pMapURLToSite,
                                java.util.Set<java.lang.String> pURLsToRemove)
process a single URL


transformProductionURLS

protected java.util.Map<java.lang.String,java.lang.String> transformProductionURLS(RepositoryItem[] pSites)
transform the production URLs using the transform rule


transformURL

protected java.lang.String transformURL(java.lang.String pURL)
transform a url


findLevelStart

protected int findLevelStart(java.lang.String pURL,
                             int pLevel)
get the index of the level start in the passed-in url

Parameters:
pURL - the URL string
pLevel - the int level to find the start of
Returns:
the index of the start of the level, or -2 if pURL is null, or pLevel is less than 1, or the passed in URL does not have enough levels. return -1 if the URL has no prefix in front of the level start

findLevelEnd

protected int findLevelEnd(java.lang.String pURL,
                           int pLevelStartIndex)
get the index of the level end in the passed-in url

Parameters:
pURL - the URL string
pLevelStartIndex - the start index of the level
Returns:
the index of the end of the level, or -1 if pURL is blank, or pLevelStartIndex is less than 0

parseTransformFile

protected boolean parseTransformFile()
read in the transform file


lowercaseDomainName

public java.lang.String lowercaseDomainName(java.lang.String pURL)
lowercase the domain name portion of a url

Parameters:
pURL -
Returns:
the URL with the domain name portion in lower case

getAdminServlet

public javax.servlet.Servlet getAdminServlet()
Returns the Servlet that will handle requests directed at this service. This will first check to see if the servlet is already created, and if not it will create it by calling createAdminServlet.

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

createAdminServlet

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

Overrides:
createAdminServlet in class GenericService

registerRuleFilter

public void registerRuleFilter(URLPatternMatchingRuleFilter pFilter)
Description copied from interface: URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar
Register the specified URLPatternMatchingRuleFilter.

Specified by:
registerRuleFilter in interface URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar