Custom request attributes for servlet caching
You can create custom request attributes for servlet caching by adding them to the
<map> tag.
The DynaCacheFilterMappings component tag in the
wc-server.xml instance configuration file has a property that defines several
<map> tags. Each <map> tag defines how a request attribute
can be added to the HttpServletRequest object. Each <map> tag
can specify the following attributes:className- The fully qualified Java class name of the class that provides a static method that can be called to determine the attribute value.dynacacheAttributeName- The name of the attribute to be added to theHttpServletRequestobject.methodName- The name of a static method of the class that is specified by theclassNameattribute. The static method returns ajava.lang.Stringand accepts the following parameters:javax.servlet.http.HttpServletRequest- The request objectcom.ibm.commerce.command.CommandContext- The command context for this requestjava.lang.String- The name of the attribute (the value of thedynacacheAttributeName <map>configuration attribute).
HttpServletRequest by using the setAttribute method.You can call the
MyClass.getMyAttributeValue method on each request to
generate an attribute value for a request attribute that is named "MyAttribute",
which is then added to the request object. To call this method on each request, specify the
following <map>
tag:
<map
className="com.mycompany.MyClass"
display="false" dynacacheAttributeName="MyAttribute"
methodName="getMyAttributeValue" name="getMyAttributeValue"/>