atg.repository.seo
Class IndirectUrlTemplate

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.repository.seo.UrlTemplate
              extended by atg.repository.seo.IndirectUrlTemplate
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, java.util.EventListener

public class IndirectUrlTemplate
extends UrlTemplate

Represents the template for an indirect URL.

An indirect URL is typically a URL that does not contain any query parameters. It is usually generated for search spider visitors that are more sensitive to URLs that contain query parameters.

The generated URL itself does not correspond to an actual page on a website. It is intended that the SEO jump servlet will convert the indirect URL to a direct URL that does contain query parameters. The servlet will then forward or redirect the visitor to the direct URL

This class contains properties and methods for the following tasks


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  UrlTemplate mForwardUrlTemplate
          UrlTemplate to create a direct Url from this indirect Url.
 java.lang.String mForwardUrlTemplateFormat
          Property that defines the format of the forward URL
protected  java.util.regex.Pattern mIndirectRegexPattern
          Regex pattern that matches the indirect Url
protected  java.util.Map mRegexElementMap
          Hashmap of regex elements to use to populate the forward Url template
 boolean mUseUrlRedirect
          Property that controls whether the jump servlet should use URL redirect instead of URL forward.
 
Fields inherited from class atg.repository.seo.UrlTemplate
mExcludedBrowserTypes, mLogger, mLookups, mMaxUrlLength, mMessageFormat, mSupportedBrowserTypes, mUrlParameters, mUrlTemplateFormat, mUseDefaultWebApp, mWebApp
 
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
IndirectUrlTemplate()
           
 
Method Summary
 java.lang.String getDefaultUrl()
           
 java.lang.String getForwardUrl(DynamoHttpServletRequest pRequest, java.lang.String pIndirectUrl, WebApp pDefaultWebApp, Repository pDefaultRepository)
          Method to convert an indirect 'friendly' Url into a destination Url for forwarding.
 UrlTemplate getForwardUrlTemplate()
          Getter method for the forward Url template object.
 java.lang.String getForwardUrlTemplateFormat()
          Gets the format of the forward URL, which will have {paramName} placeholders for parameter values to be inserted.
 java.lang.String getIndirectRegex()
          Gets the regular expression pattern that is a property of this IndirectUrlTemplate instance.
 java.util.regex.Pattern getIndirectRegexPattern()
          Method to get the Pattern object for the indirect regex.
 java.util.List getRegexElementList()
          Gets the regex element list that is a property of this IndirectUrlTemplate instance.
protected  void initialize()
          This method will perform the following initialisation steps: Create a UrlTemplate instance for the URL format used by the droplet Build the regex pattern Parse the element type list Create a UrlTemplate instance for the forward URL format used by the jump servlet
 boolean isUseUrlRedirect()
          Indicates whether the jump servlet should use URL redirect instead of URL forward when using this IndirectUrlTemplate instance.
 java.util.regex.Matcher matches(java.lang.String pUrl)
          Checks whether the Url matches this template.
 void setDefaultUrl(java.lang.String pDefaultUrl)
           
 void setForwardUrlTemplate(UrlTemplate pForwardUrlTemplate)
          Setter method for the forward Url template object.
 void setForwardUrlTemplateFormat(java.lang.String pForwardUrlTemplateFormat)
          Sets the format of the forward URL.
 void setIndirectRegex(java.lang.String pIndirectRegex)
          Sets the regular expression pattern that is associated with this IndirectUrlTemplate instance.
 void setRegexElementList(java.util.List pRegexElementList)
          Sets the regex element list that is associated with this instance.
 void setUseUrlRedirect(boolean pUseUrlRedirect)
          Sets the flag which controls whether URL redirect is to be used by the jump servlet.
 
Methods inherited from class atg.repository.seo.UrlTemplate
cloneUrlParameters, doStartService, formatUrl, getExcludedBrowserTypes, getMaxUrlLength, getMessageFormat, getSupportedBrowserTypes, getUrlTemplateFormat, getWebApp, getWebAppRegistry, isSupported, parseTemplate, setExcludedBrowserTypes, setLookupMap, setMaxUrlLength, setSupportedBrowserTypes, setUrlTemplateFormat, setUseDefaultWebApp, setWebApp, setWebAppRegistry, toString, useDefaultWebApp
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, 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, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mForwardUrlTemplate

protected UrlTemplate mForwardUrlTemplate
UrlTemplate to create a direct Url from this indirect Url. Used by forward servlet.


mIndirectRegexPattern

protected java.util.regex.Pattern mIndirectRegexPattern
Regex pattern that matches the indirect Url


mRegexElementMap

protected java.util.Map mRegexElementMap
Hashmap of regex elements to use to populate the forward Url template


mForwardUrlTemplateFormat

public java.lang.String mForwardUrlTemplateFormat
Property that defines the format of the forward URL


mUseUrlRedirect

public boolean mUseUrlRedirect
Property that controls whether the jump servlet should use URL redirect instead of URL forward.

Constructor Detail

IndirectUrlTemplate

public IndirectUrlTemplate()
Method Detail

getIndirectRegex

public java.lang.String getIndirectRegex()
Gets the regular expression pattern that is a property of this IndirectUrlTemplate instance.

Returns:

setIndirectRegex

public void setIndirectRegex(java.lang.String pIndirectRegex)
Sets the regular expression pattern that is associated with this IndirectUrlTemplate instance.

Parameters:
pIndirectRegex - The regular expression pattern to set

getRegexElementList

public java.util.List getRegexElementList()
Gets the regex element list that is a property of this IndirectUrlTemplate instance.

Returns:
A List of regular expression elements, where each entry corresponds to a group in the regex expression property.

setRegexElementList

public void setRegexElementList(java.util.List pRegexElementList)
Sets the regex element list that is associated with this instance.

Parameters:
pregexElementList - The regular expression list to set.

getForwardUrlTemplateFormat

public java.lang.String getForwardUrlTemplateFormat()
Gets the format of the forward URL, which will have {paramName} placeholders for parameter values to be inserted.

Returns:
The format of the forward URL

setForwardUrlTemplateFormat

public void setForwardUrlTemplateFormat(java.lang.String pForwardUrlTemplateFormat)
Sets the format of the forward URL.

Parameters:
pForwardUrlTemplateFormat - The forward URL format to set

getDefaultUrl

public java.lang.String getDefaultUrl()

setDefaultUrl

public void setDefaultUrl(java.lang.String pDefaultUrl)

isUseUrlRedirect

public boolean isUseUrlRedirect()
Indicates whether the jump servlet should use URL redirect instead of URL forward when using this IndirectUrlTemplate instance.

Returns:
true if URL redirect is to be used, false if URL forward is to be used.

setUseUrlRedirect

public void setUseUrlRedirect(boolean pUseUrlRedirect)
Sets the flag which controls whether URL redirect is to be used by the jump servlet.

Parameters:
useRedirect - The value to set. Should be true if URL redirect should be used, false otherwise.

initialize

protected void initialize()
                   throws atg.repository.seo.ItemLinkException
This method will perform the following initialisation steps:

Specified by:
initialize in class UrlTemplate
Throws:
ItemLinkException - Indicates failure to initialise this instance.
See Also:
UrlTemplate.initialize()

getIndirectRegexPattern

public java.util.regex.Pattern getIndirectRegexPattern()
Method to get the Pattern object for the indirect regex.

Returns:
Pattern object for indirect regex

getForwardUrlTemplate

public UrlTemplate getForwardUrlTemplate()
Getter method for the forward Url template object.

Returns:
the forward UrlTemplate

setForwardUrlTemplate

public void setForwardUrlTemplate(UrlTemplate pForwardUrlTemplate)
Setter method for the forward Url template object.

Parameters:
pForwardUrlTemplate - UrlTemplate object

matches

public java.util.regex.Matcher matches(java.lang.String pUrl)
Checks whether the Url matches this template.

Parameters:
pUrl - String Url to check against this parser's regex
Returns:
the Matcher object if this template matches otherwise null

getForwardUrl

public java.lang.String getForwardUrl(DynamoHttpServletRequest pRequest,
                                      java.lang.String pIndirectUrl,
                                      WebApp pDefaultWebApp,
                                      Repository pDefaultRepository)
                               throws atg.repository.seo.ItemLinkException
Method to convert an indirect 'friendly' Url into a destination Url for forwarding. Uses the regex pattern and element list to parse the indirect URL and the forward URL template to create the new one.

Parameters:
pRequest - DynamoHttpServetRequest object
pIndirectUrl - String Url that matches the indirect url template
pDefaultWebApp - The default web app, which is used to determine the context path
pDefaultRepository - The default repository that is used when a parameter element does not have a repository defined.
Returns:
String destination Url to forward to. Will be null> if a match was not made.
Throws:
ItemLinkException - Indicates failure to determine the forward URL.