Class PromotionServlet

  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.commerce.promotion.PromotionServlet
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class PromotionServlet
extends InsertableServletImpl

The PromotionServlet allows a promotion to be added to a users profile via a URL. It must be in the servlet pipeline for this to work. If it is in the servlet pipeline and enabled is true then the following example demonstrates how to use PromotionServlet:

 <a href="../../whatever.jhtml" encode="true"> 
   <param name="PROMO" value="promo10102"> 
   Click here to get 20% discount on shirts... 

Note: First, encode=true is required otherwise the parameter is added as a query parameter and not a url parameter and it won't work Second, value for the param tag is the promotion id in the /atg/commerce/pricing/Promotions repository for item descriptor(s) given in property promotionItemDescriptorNames.

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mPromotionParameter
Fields inherited from class atg.nucleus.GenericService
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
Constructor Summary
Method Summary
 java.lang.String getProfile()
          The profile that the promotion will be added to.
 java.lang.String[] getPromotionItemDescriptorNames()
          These are the names of the valid promotion item descriptors
 java.lang.String getPromotionParameter()
          This is the name of the request parameter than contains the promotion.
 Repository getPromotionRepository()
          This is the repository that contains the promotions
 PromotionTools getPromotionTools()
          This is a helper class for manipulating promotions
 boolean isEnabled()
          If enabled is true, then this servlet is "active" in that it will look for a PROMO parameter to add to the current profile.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          The service method that looks for the PROMO parameter and adds it to the profile, before pass the request to the next servlet in the pipeline.
 void setEnabled(boolean pEnabled)
 void setProfile(java.lang.String pProfile)
 void setPromotionItemDescriptorNames(java.lang.String[] pPromotionItemDescriptorNames)
 void setPromotionParameter(java.lang.String pPromotionParameter)
 void setPromotionRepository(Repository pPromotionRepository)
 void setPromotionTools(PromotionTools pPromotionTools)
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
doStartService, 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, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, 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, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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


public static java.lang.String CLASS_VERSION
Class version string


protected java.lang.String mPromotionParameter
Constructor Detail


public PromotionServlet()
Method Detail


public void setProfile(java.lang.String pProfile)


public java.lang.String getProfile()
The profile that the promotion will be added to. By default this is the profile located at /atg/userprofiling/Profile


public void setPromotionParameter(java.lang.String pPromotionParameter)


public java.lang.String getPromotionParameter()
This is the name of the request parameter than contains the promotion. By default this is PROMO


public void setPromotionRepository(Repository pPromotionRepository)


public Repository getPromotionRepository()
This is the repository that contains the promotions


public void setPromotionItemDescriptorNames(java.lang.String[] pPromotionItemDescriptorNames)


public java.lang.String[] getPromotionItemDescriptorNames()
These are the names of the valid promotion item descriptors


public void setPromotionTools(PromotionTools pPromotionTools)


public PromotionTools getPromotionTools()
This is a helper class for manipulating promotions


public void setEnabled(boolean pEnabled)


public boolean isEnabled()
If enabled is true, then this servlet is "active" in that it will look for a PROMO parameter to add to the current profile.


public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
The service method that looks for the PROMO parameter and adds it to the profile, before pass the request to the next servlet in the pipeline.

service in class PipelineableServletImpl
Throws: - if an error occurred while reading or writing the servlet request
javax.servlet.ServletException - if an error occurred while processing the servlet request