atg.search.servlet
Class SearchClickThroughServlet

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.search.servlet.SearchClickThroughServlet
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 SearchClickThroughServlet
extends InsertableServletImpl

This class is used to create components for inserting into servlet pipeline to get search click identifier (query id and document id) from the request. After getting searchClickId value and parsing it into queryId and documentId values it perform lookup for document and cacheElement objects in cache/history components. In case of all objects where found, we can treat such activity as a successful click-through action and fire SearchClickThroughMessage JMS event with required information.

Component is implemented to proceed only with configured list of page URLs and configured request parameter names.

Enabled property controls whether servlet should process request or transfer its execution to the next one in a chain. SearchClickIdQueryArgs property contains query parameter names which we will look for searchClickId value in request. ClickThroughPages property controls the list of pages which will be processed by servlet and we will look for searchClickIdQueryArgs for them. Wildcard characters can be used. If this property is null, then searchClickIdQueryArgs are looked for all pages.

The use of the clickThroughPages configuration is shown in the following example:

 clickThroughPages=/*/*/productDetailWithPicker.jsp,/*/*/productDetail.jsp,/*/*/giftCertificateProduct.jsp,/*/facet/facetGlossary.jsp
 


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
SearchClickThroughServlet()
           
 
Method Summary
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 java.lang.String findQueryArgument(DynamoHttpServletRequest pRequest, java.lang.String[] pQueryArgs)
          Return the first pQueryArgs that is found in the request.
 Cache getClickThroughPageCache()
          Returns clickThroughPageCache property.
protected  PagePattern[] getClickThroughPagePatterns()
          Returns clickThroughPagePatterns property compiled from the elements in the clickThroughPages property.
 java.lang.String[] getClickThroughPages()
          Returns clickThroughPages property.
 java.lang.String getHistoryComponentPath()
          Returns historyComponentPath property.
 java.lang.String getSearchClickIdDelimiter()
          Returns searchClickIdDelimiter property.
 java.lang.String[] getSearchClickIdQueryArgs()
          Returns searchClickIdQueryArgs property.
 atg.search.events.SearchMessageSource getSearchMessageSource()
          Returns searchMessageSource property.
 java.lang.String getSearchQueryCachePath()
          Returns searchQueryCachePath property.
 boolean isEnabled()
          Returns property 'enabled' which specifies whether servlet should process request
 boolean pathMatchesPattern(java.lang.String pPath, PagePattern[] pPatterns, Cache pCache)
          This method will determine if the given path fits one of the patterns.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          The service method looks for the searchClickId parameter value in request.
 void setClickThroughPageCache(Cache pClickThroughPageCache)
          Sets clickThroughPageCache property.
protected  void setClickThroughPagePatterns(PagePattern[] pClickThroughPagePatterns)
          Sets clickThroughPagePatterns property compiled from the elements in the clickThroughPages property.
 void setClickThroughPages(java.lang.String[] pClickThroughPages)
          Sets clickThroughPages property.
 void setEnabled(boolean pEnabled)
          Sets property 'enabled' which specifies whether servlet should process request
 void setHistoryComponentPath(java.lang.String pHistoryComponentPath)
          Sets historyComponentPath property.
 void setSearchClickIdDelimiter(java.lang.String pSearchClickIdDelimiter)
          Sets searchClickIdDelimiter property.
 void setSearchClickIdQueryArgs(java.lang.String[] pSearchClickIdQueryArgs)
          Sets searchClickIdQueryArgs property.
 void setSearchMessageSource(atg.search.events.SearchMessageSource pSearchMessageSource)
          Sets searchMessageSource property.
 void setSearchQueryCachePath(java.lang.String pSearchQueryCachePath)
          Sets searchQueryCachePath property.
 
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

SearchClickThroughServlet

public SearchClickThroughServlet()
Method Detail

setSearchClickIdQueryArgs

public void setSearchClickIdQueryArgs(java.lang.String[] pSearchClickIdQueryArgs)
Sets searchClickIdQueryArgs property. This property contains the list of query arguments that specify which searchClickId parameter names we will lookup in request.

Parameters:
pSearchClickIdQueryArgs - New value for searchClickIdQueryArgs property

getSearchClickIdQueryArgs

public java.lang.String[] getSearchClickIdQueryArgs()
Returns searchClickIdQueryArgs property. This property contains the list of query arguments that specify which searchClickId parameter names we will lookup in request.

Returns:
searchClickIdQueryArgs property

setClickThroughPages

public void setClickThroughPages(java.lang.String[] pClickThroughPages)
Sets clickThroughPages property. This property contains the pages on which the searchClickIdQueryArgs should be looked for. Wildcard characters can be used. If this property is null, the searchClickIdQueryArgs are looked for on all pages.

Parameters:
pClickThroughPages - New value for clickThroughPages property

getClickThroughPages

public java.lang.String[] getClickThroughPages()
Returns clickThroughPages property. This property contains the pages on which the searchClickIdQueryArgs should be looked for. Wildcard characters can be used. If this property is null, the searchClickIdQueryArgs are looked for on all pages.

Returns:
clickThroughPages property

setClickThroughPagePatterns

protected void setClickThroughPagePatterns(PagePattern[] pClickThroughPagePatterns)
Sets clickThroughPagePatterns property compiled from the elements in the clickThroughPages property.

Parameters:
pClickThroughPagePatterns - New value for clickThroughPagePatterns property

getClickThroughPagePatterns

protected PagePattern[] getClickThroughPagePatterns()
Returns clickThroughPagePatterns property compiled from the elements in the clickThroughPages property.

Returns:
clickThroughPagePatterns property

setClickThroughPageCache

public void setClickThroughPageCache(Cache pClickThroughPageCache)
Sets clickThroughPageCache property. This property contains the cache storing whether URLs match clickThroughPagePatterns.

Parameters:
pClickThroughPageCache - New value for clickThroughPageCache property

getClickThroughPageCache

public Cache getClickThroughPageCache()
Returns clickThroughPageCache property. This property contains the cache storing whether URLs match clickThroughPagePatterns)

Returns:
clickThroughPageCache property

setEnabled

public void setEnabled(boolean pEnabled)
Sets property 'enabled' which specifies whether servlet should process request

Parameters:
pEnabled - New value for property 'enabled'

isEnabled

public boolean isEnabled()
Returns property 'enabled' which specifies whether servlet should process request

Returns:
Property 'enabled'

getSearchClickIdDelimiter

public java.lang.String getSearchClickIdDelimiter()
Returns searchClickIdDelimiter property. This property contains delimiter which is used to delimit parts of the search click id.

Returns:
searchClickIdDelimiter property

setSearchClickIdDelimiter

public void setSearchClickIdDelimiter(java.lang.String pSearchClickIdDelimiter)
Sets searchClickIdDelimiter property. This property contains delimiter which is used to delimit parts of the search click id.

Parameters:
pSearchClickIdDelimiter - New value for searchClickIdDelimiter property

setSearchQueryCachePath

public void setSearchQueryCachePath(java.lang.String pSearchQueryCachePath)
Sets searchQueryCachePath property. This property contains nucleus path to search query cache.

Parameters:
pSearchQueryCachePath - New value for searchQueryCachePath property

getSearchQueryCachePath

public java.lang.String getSearchQueryCachePath()
Returns searchQueryCachePath property. This property contains nucleus path to search query cache.

Returns:
searchQueryCachePath property

setHistoryComponentPath

public void setHistoryComponentPath(java.lang.String pHistoryComponentPath)
Sets historyComponentPath property. This property contains nucleus path to component used to keep messages of type SearchClickThroughMessage.

Parameters:
pHistoryComponentPath - New value for historyComponentPath property

getHistoryComponentPath

public java.lang.String getHistoryComponentPath()
Returns historyComponentPath property. This property contains nucleus path to component used to keep messages of type SearchClickThroughMessage.

Returns:
historyComponentPath property

setSearchMessageSource

public void setSearchMessageSource(atg.search.events.SearchMessageSource pSearchMessageSource)
Sets searchMessageSource property. This property contains message source used to fire search events.

Parameters:
pSearchMessageSource - New value for searchMessageSource property

getSearchMessageSource

public atg.search.events.SearchMessageSource getSearchMessageSource()
Returns searchMessageSource property. This property contains message source used to fire search events.

Returns:
searchMessageSource property

doStartService

public void doStartService()
                    throws ServiceException
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. This method should start any processes required to run the service.

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

pathMatchesPattern

public boolean pathMatchesPattern(java.lang.String pPath,
                                  PagePattern[] pPatterns,
                                  Cache pCache)
                           throws java.lang.Exception
This method will determine if the given path fits one of the patterns.

Parameters:
pPath - The URL to search for
pPatterns - The URL patterns
pCache - Cached results of previous paths
Returns:
boolean indicating if the path fits one of the patterns
Throws:
java.lang.Exception

findQueryArgument

public java.lang.String findQueryArgument(DynamoHttpServletRequest pRequest,
                                          java.lang.String[] pQueryArgs)
Return the first pQueryArgs that is found in the request. Return null if none of them are found.

Returns:
String which represent request parameter value

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
The service method looks for the searchClickId parameter value in request. After getting searchClickId value and parsing it into queryId and documentId values it performs lookup for document and cacheElement objects in cache/history components. In case of all objects where found, we can treat such activity as a successful click-through action and fire SearchClickThroughMessage JMS event with required information. And finally, pass the request to the next servlet in the pipeline.

Overrides:
service in class PipelineableServletImpl
Parameters:
pRequest - The request to be processed.
pResponse - Response object for this request.
Throws:
javax.servlet.ServletException - An application specific error occurred processing this request.
java.io.IOException - An error occurred reading data from the request or writing data to the response.