public class EMarketingSpotMetaDataGenerator
extends java.lang.Object
implements com.ibm.websphere.servlet.cache.MetaDataGenerator
e-Marketing Spot | parent JSP | e-Marketing Spot JSP cache behavior | e-Marketing Spot JSP consume behavior | time out |
static | cached | cached in parent JSP | consumed by parent JSP | earliest of all activities on all e-Marketing Spots on the page |
static | not cached | cached separately | not consumed | earliest of all activities on the e-Marketing Spot |
dynamic | cached | not cached | not consumed | not applicable |
dynamic | not cached | not cached | not consumed | not applicable |
This class should be specified in the cachespec definition for an e-Marketing Spot JSP fragment. Here is an example:
<cache-entry> <class>servlet</class> <name>/Madisons/Snippets/Marketing/ESpot/ContentAreaESpot.jsp</name> <!-- The default value for do-not-consume must be true. The actual value will be dynamically set at runtime by the EMarketingSpotMetaDataGenerator. --> <property name="do-not-consume">true</property> <!-- The default value for do-not-cache must be true. The actual value will be dynamically set at runtime by the EMarketingSpotMetaDataGenerator. --> <property name="do-not-cache">true</property> <property name="save-attributes">false</property> <cache-id> <component id="emsName" type="parameter"> <required>false</required> </component> <component id="DC_storeId" type="attribute"> <required>false</required> </component> <component id="DC_lang" type="attribute"> <required>false</required> </component> <!-- Use the EMarketingSpotMetaDataGenerator along with the TagEMarketingSpotCache JSTL tag. --> <metadatagenerator>com.ibm.commerce.marketing.cache.EMarketingSpotMetaDataGenerator</metadatagenerator> </cache-id> </cache-entry>The JSP that included the e-Marketing Spot must specify the emsName parameter. You must also include the eMarketingSpotCache tag in the e-Marketing Spot JSP fragment. See TagEMarketingSpotCache for details.
It is recommended that the cachespec also contain the command cache entries defined in WC_installdir/samples/dynacache/marketing/cachespec.xml and that the Get MarketingSpotData getData tag on the e-Marketing Spot JSP include the DM_marketingSpotBehavior parameter.
<% Object DM_marketingSpotBehavior = request.getAttribute("DM_emsBehavior-" + emsName); if (DM_marketingSpotBehavior != null) { request.setAttribute("DM_marketingSpotBehavior", DM_marketingSpotBehavior.toString()); } %> <wcf:param name="DM_marketingSpotBehavior" value="${requestScope.DM_marketingSpotBehavior}"/>In some situations, a specific e-Marketing Spot may want to specify that the e-Marketing Spot is static or dynamic, and not rely on the automatic determination. To specify the e-Marketing Spot behavior, pass the parameter marketingSpotBehavior when importing the e-Marketing Spot JSP snippet. Specify a value of 0 for static behavior ,and a value of 1 for dynamic behavior.
By default, the e-Marketing Spot JSP fragment will be consumed and cached as part of the parent JSP if the parent JSP is cached. If you always want to cache the e-Marketing Spot JSP fragment separately, then the including JSP must also specify the cacheWithParent parameter as false.
The time out will be set for the cached fragment to be the earliest of any start date or end date of any activity scheduled to the e-Marketing Spot that is after the current time. The time out will only be set if the time is earlier than the current time out of the page. Usually the time out is set in the cachespec, but can specified when including the e-Marketing Spot JSP if required.
Here is an example how to set the optional parameters for an e-Marketing Spot. The cacheWithParent parameter is set to cache the ContentAreaESpot.jsp separately from the home page. The marketingSpotBehavior parameter is configured that the spot should be always cached, and not check the behavior of the activities on the e-Marketing Spot. The pageTimeLimit parameter is configured that the default time limit is set to one hour.
<c:import url="${jspStoreDir}Snippets/Marketing/ESpot/ContentAreaESpot.jsp"> <c:param name="emsName" value="HomePageRow1Ads" /> <c:param name="cacheWithParent" value="false" /> <c:param name="marketingSpotBehavior" value="0" /> <c:param name="pageTimeLimit" value="3600" /> </c:import>
Modifier and Type | Field and Description |
---|---|
static java.lang.String | ATTRIBUTE_MARKETING_SPOT_TIME_LIMIT
Constant for the request attribute that contains the cache entry time limit.
|
static java.lang.String | ATTRIBUTE_PREFIX_MARKETING_SPOT_BEHAVIOR
Constant for the request attribute that contains the e-Marketing Spot behavior.
|
static java.lang.String | COPYRIGHT
COPYRIGHT
|
static java.lang.String | PARAM_CACHE_WITH_PARENT
Constant for the e-Marketing Spot JSP parameter to specify if the e-Marketing Spot JSP should be cached with the parent JSP.
|
static java.lang.String | PARAM_MARKETING_SPOT_NAME
Constant for the e-Marketing Spot JSP parameter for the e-Marketing Spot name.
|
static java.lang.String | PARAM_OVERRIDE_MARKETING_SPOT_BEHAVIOR
Constant for the request attribute to specify the e-Marketing Spot behavior.
|
static java.lang.String | PARAM_OVERRIDE_TIME_LIMIT
Constant for the request attribute to specify the page cache time limit in seconds.
|
Constructor and Description |
---|
EMarketingSpotMetaDataGenerator() |
Modifier and Type | Method and Description |
---|---|
static boolean | getCacheSeparately(javax.servlet.http.HttpServletRequest request)
This method determines if the e-Marketing Spot JSP snippet should be cached separately.
|
void | initialize(com.ibm.websphere.servlet.cache.CacheConfig cc)
This method performs no actions.
|
void | setMetaData(com.ibm.websphere.servlet.cache.ServletCacheRequest req, javax.servlet.http.HttpServletResponse resp)
This method uses the task command GetMarketingSpotBehaviorCmd to determine the caching behavior for the e-Marketing Spot.
|
protected void | setUncacheable(boolean cacheFlag, javax.servlet.http.HttpServletRequest request)
This method dynamically sets the do-not-cache setting for the JSP.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String PARAM_MARKETING_SPOT_NAME
public static final java.lang.String PARAM_CACHE_WITH_PARENT
public static final java.lang.String ATTRIBUTE_PREFIX_MARKETING_SPOT_BEHAVIOR
public static final java.lang.String ATTRIBUTE_MARKETING_SPOT_TIME_LIMIT
public static final java.lang.String PARAM_OVERRIDE_MARKETING_SPOT_BEHAVIOR
public static final java.lang.String PARAM_OVERRIDE_TIME_LIMIT
public static boolean getCacheSeparately(javax.servlet.http.HttpServletRequest request)
public void setMetaData(com.ibm.websphere.servlet.cache.ServletCacheRequest req, javax.servlet.http.HttpServletResponse resp)
protected void setUncacheable(boolean cacheFlag, javax.servlet.http.HttpServletRequest request)
public void initialize(com.ibm.websphere.servlet.cache.CacheConfig cc)