public class PromotionServlet extends InsertableServletImpl
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... </a>
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected java.lang.String |
mPromotionParameter |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
PromotionServlet() |
Modifier and Type | Method and Description |
---|---|
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) |
doStartService, getInsertAfterServlet, setInsertAfterServlet
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
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
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNextServlet, passRequest, setNextServlet
public static java.lang.String CLASS_VERSION
protected java.lang.String mPromotionParameter
public void setProfile(java.lang.String pProfile)
public java.lang.String getProfile()
public void setPromotionParameter(java.lang.String pPromotionParameter)
public java.lang.String getPromotionParameter()
PROMO
public void setPromotionRepository(Repository pPromotionRepository)
public Repository getPromotionRepository()
public void setPromotionItemDescriptorNames(java.lang.String[] pPromotionItemDescriptorNames)
public java.lang.String[] getPromotionItemDescriptorNames()
public void setPromotionTools(PromotionTools pPromotionTools)
public PromotionTools getPromotionTools()
public void setEnabled(boolean pEnabled)
public boolean isEnabled()
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) throws java.io.IOException, javax.servlet.ServletException
service
in class PipelineableServletImpl
java.io.IOException
- if an error occurred while reading or writing
the servlet requestjavax.servlet.ServletException
- if an error occurred while processing
the servlet request