|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.multisite.SiteURLManager
public class SiteURLManager
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 |
void |
doStartService()
start service |
protected java.lang.String |
encodeURL(DynamoHttpServletRequest pRequest,
java.lang.String pURL)
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 |
PushedSiteParamFilter |
getPushedSiteParamFilter()
get PushedSiteParamFilter |
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 |
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 |
setPushedSiteParamFilter(PushedSiteParamFilter pPushedSiteParamFilter)
set PushedSiteParamFilter |
void |
setRebuildURLMapsOnPropertiesChangedEvents(boolean pRebuildURLMapsOnPropertiesChangedEvents)
set RebuildURLMapsOnPropertiesChangedEvents |
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.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 |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public SiteURLManager()
Method Detail |
---|
public void setSiteManager(SiteManager pSiteManager)
pSiteManager
- the SiteManagerpublic SiteManager getSiteManager()
public int getUrlCacheSize()
public void setUrlCacheSize(int pUrlCacheSize)
pUrlCacheSize
- the urlCacheSize to setpublic float getUrlCachePercentageFull()
public void setProductionURLPropertyName(java.lang.String pProductionURLPropertyName)
pProductionURLPropertyName
- the ProductionURLPropertyNamepublic java.lang.String getProductionURLPropertyName()
public void setAdditionalProductionURLPropertyName(java.lang.String pAdditionalProductionURLPropertyName)
pAdditionalProductionURLPropertyName
- the AdditionalProductionURLPropertyNamepublic java.lang.String getAdditionalProductionURLPropertyName()
public void setAutoAppendStickySiteParams(boolean pAutoAppendStickySiteParams)
pAutoAppendStickySiteParams
- the AutoAppendStickySiteParamspublic boolean isAutoAppendStickySiteParams()
public void setPushedSiteParamFilter(PushedSiteParamFilter pPushedSiteParamFilter)
pPushedSiteParamFilter
- the PushedSiteParamFilterpublic PushedSiteParamFilter getPushedSiteParamFilter()
public void setTransformFile(atg.xml.XMLFile pTransformFile)
pTransformFile
- the TransformFilepublic atg.xml.XMLFile getTransformFile()
public void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pXMLToolsFactory)
pXMLToolsFactory
- the XMLToolsFactorypublic atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
public atg.xml.tools.XMLToDOMParser getXMLToDOMParser()
public void setRebuildURLMapsOnPropertiesChangedEvents(boolean pRebuildURLMapsOnPropertiesChangedEvents)
pRebuildURLMapsOnPropertiesChangedEvents
- the RebuildURLMapsOnPropertiesChangedEventspublic boolean isRebuildURLMapsOnPropertiesChangedEvents()
public void setDefaultProtocol(java.lang.String pDefaultProtocol)
pDefaultProtocol
- The default protocolpublic java.lang.String getDefaultProtocol()
public void setSuppressDuplicateURLWarnings(boolean pSuppressDuplicateURLWarnings)
pSuppressDuplicateURLWarnings
- the SuppressDuplicateURLWarningspublic boolean isSuppressDuplicateURLWarnings()
public atg.multisite.SiteBaseURLProcessor[] getSiteBaseURLProcessors()
public void setSiteBaseURLProcessors(atg.multisite.SiteBaseURLProcessor[] pSiteBaseURLProcessors)
pSiteBaseURLProcessors
- the siteBaseURLProcessors to setpublic void setEnableURLTransform(boolean pEnableURLTransform)
pEnableURLTransform
- the EnableURLTransformpublic boolean isEnableURLTransform()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic java.lang.String getSiteIdForURL(java.lang.String pURL)
pURL
- the request URL for which a matching site ID needs
to be found
public SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL)
public java.lang.String getSiteIdForURL(java.lang.String pURL, java.util.Map<java.lang.String,java.lang.String> pMap)
pURL
- the urlpMap
- the map of URLs to site Ids
public SiteURLManager.SiteDeterminationURL getSiteURLForURL(java.lang.String pURL, java.util.Map<java.lang.String,java.lang.String> pMap)
public java.util.Set<java.lang.String> getOrderedURLs()
public SiteURLManager.OrderedSiteURLInfo getOrderedSiteURLInfo()
protected java.lang.String trimLevel(java.lang.String pURI)
protected void addStickySite(java.lang.StringBuffer pURLBuffer, java.lang.String pSiteId)
pURLBuffer
- The StringBuffer to add the query params topSiteId
- The Site ID to pushprotected void addQueryParams(java.lang.StringBuffer pURLBuffer, java.lang.String pQueryParams)
pURLBuffer
- The URL StringBuffer to add the query params topQueryParams
- The query params to addprotected java.lang.String removeAfterLastSlash(java.lang.String pURL)
pURL
- The URL to trim
protected java.lang.String removeSiteDeterminationPath(java.lang.String pURL)
pURL
- The url
protected java.lang.String removeBeforeFirstSlash(java.lang.String pURL)
pURL
- The URL string to trim
protected void appendSlashIfNeeded(java.lang.StringBuffer pURLBuffer)
pURLBuffer
- The URL bufferprotected java.lang.String removeTrailingSlash(java.lang.String pURL)
pURL
- The url to remove the slash from.
protected java.lang.String removeStandardPorts(java.lang.String pURL)
pURL
- The string to remove from
protected java.lang.String getCurrentRequestURL(DynamoHttpServletRequest pRequest, boolean pInInclude)
pRequest
- The current request. Returns an empty string if null.pInInclude
- If the url should use the path of the include.
public java.lang.String getProductionSiteBaseURL(java.lang.String pSiteId, java.lang.String pPath, java.lang.String pQueryParams, java.lang.String pProtocol, boolean pInInclude)
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 foundpPath
- optional path string that will be included in the returned URLpQueryParams
- 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 parampProtocol
- optional protocol to use for absolute urls. If null
defaultProtocol will be usedpInInclude
- 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
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)
pRequest
- The current request.pSiteId
- the Id of the Site for which the production site base URL
should be foundpPath
- optional path string that will be included in the returned URLpQueryParams
- 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 parampProtocol
- optional protocol to use for absolute urls. If null
defaultProtocol will be usedpInInclude
- if relative paths should use the URI of the included
page.
protected java.lang.String processSiteBaseURL(java.lang.String pURL)
pURL
- The Site's base URL.
protected java.lang.String encodeURL(DynamoHttpServletRequest pRequest, java.lang.String pURL)
pRequest
- The current request. If null, the URL is returned
unmodified.pURL
- The URL to encode
protected void registerAsPropertyChangedListener()
public void propertiesChanged(PropertiesChangedEvent pEvent)
propertiesChanged
in interface PropertiesChangedListener
pEvent
- the properties changed eventpublic void handleMultisiteChangeEvent(java.lang.String pDeploymentId)
handleMultisiteChangeEvent
in interface atg.multisite.MultisiteSnapshotDeploymentHandler
pDeploymentId
- the id of the new deploymentpublic void createURLMaps()
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)
protected java.util.Map<java.lang.String,java.lang.String> transformProductionURLS(RepositoryItem[] pSites)
protected java.lang.String transformURL(java.lang.String pURL)
protected int findLevelStart(java.lang.String pURL, int pLevel)
pURL
- the URL stringpLevel
- the int level to find the start of
protected int findLevelEnd(java.lang.String pURL, int pLevelStartIndex)
pURL
- the URL stringpLevelStartIndex
- the start index of the level
protected boolean parseTransformFile()
public java.lang.String lowercaseDomainName(java.lang.String pURL)
pURL
-
public javax.servlet.Servlet getAdminServlet()
getAdminServlet
in interface AdminableService
getAdminServlet
in class GenericService
createAdminServlet()
protected javax.servlet.Servlet createAdminServlet()
createAdminServlet
in class GenericService
public void registerRuleFilter(URLPatternMatchingRuleFilter pFilter)
URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar
registerRuleFilter
in interface URLPatternMatchingRuleFilter.URLPatternMatchingRuleFilterRegistrar
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |