ShoppingCartAttributeLoader Class

com.bea.campaign
ShoppingCartAttributeLoader Class

public class ShoppingCartAttributeLoader

    extends Object
    implements Request.AttributeLoader

A p13n request attribute loader which will load the ShoppingCart into the p13n request.

This will, by default, pull the shopping cart from the pipeline session at a session attribute "wlcs_shoppingCart", and, if found, set it in the p13n Request at an attribute called "wlcs_shoppingCart". The attribute names are controlled by the ShoppingCartAttributeLoader.getShoppingCartSetName(), ShoppingCartAttributeLoader.getShoppingCartNamespace(Object), and ShoppingCartAttributeLoader.getShoppingCartGetNames() method.

To use this class, register it in your application-config.xml in the following places:


Hierarchy
Object
  ShoppingCartAttributeLoader
All Implemented Interfaces

Request.AttributeLoader
Direct Known Subclasses

ShoppingCartAttributeLoader

Field Summary

public static final String
DEF_SHOPPING_CART_GET_NAMES
The default list of names in the PipelineSession to look for the ShoppingCart.
public static final String
DEF_SHOPPING_CART_SET_NAME
The name of the attribute to set the ShoppingCart in the p13n Request.
public static final String
SHOPPING_CART
The name of the attribute to set the ShoppingCart in the p13n Request.
 

Constructor Summary

ShoppingCartAttributeLoader()

 

Method Summary

public Object
getPipelineSession(HttpServletRequest req)
Get the PipelineSession from the http request.
public Object
getShoppingCart(Object pSession)
Get the shopping cart from the pipeline session.
public Object
getShoppingCart(HttpServletRequest req)
Get the shopping cart from the http session.
protected String[]
getShoppingCartGetNames()
Return the list of names of PipelineSession attributes to try to find the shopping cart at.
protected String
getShoppingCartNamespace(Object session)
Return the PipelineSession namespace to check for the shopping cart in.
protected String
getShoppingCartSetName()
Return the name of the attribute in the p13n Request to set the ShoppingCart to.
public void
loadAttributes(Request request, HttpServletRequest origRequest)
Load the shopping cart from the original request to the new request.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.p13n.http.Request.AttributeLoader
loadAttributes
 

Field Detail

DEF_SHOPPING_CART_GET_NAMES

public static final String DEF_SHOPPING_CART_GET_NAMES
The default list of names in the PipelineSession to look for the ShoppingCart.

Defaults to an array containing "wlcs_shoppingCart".

Related Topics

ShoppingCartAttributeLoader.getShoppingCartGetNames()


DEF_SHOPPING_CART_SET_NAME

public static final String DEF_SHOPPING_CART_SET_NAME
The name of the attribute to set the ShoppingCart in the p13n Request.

Defaults to "wlcs_shoppingCart".

Related Topics

ShoppingCartAttributeLoader.getShoppingCartSetName()
PipelineSessionConstants.SHOPPING_CART


SHOPPING_CART

public static final String SHOPPING_CART
The name of the attribute to set the ShoppingCart in the p13n Request.

 

Constructor Detail

ShoppingCartAttributeLoader

public ShoppingCartAttributeLoader()
 

Method Detail

getPipelineSession(HttpServletRequest) Method

public Object getPipelineSession(HttpServletRequest req)
Get the PipelineSession from the http request.

Returns

the PipelineSession if it's been created, null if not.

getShoppingCart(Object) Method

public Object getShoppingCart(Object pSession)
Get the shopping cart from the pipeline session.

This will look through the pipeline session session attributes defined by ShoppingCartAttributeLoader.getShoppingCartGetNames() in the namespace defined by ShoppingCartAttributeLoader.getShoppingCartNamespace(Object) and return the first ShoppingCart found.

Returns

the shopping cart if it's been initialized, null if not.

getShoppingCart(HttpServletRequest) Method

public Object getShoppingCart(HttpServletRequest req)
Get the shopping cart from the http session.

Returns

the shopping cart if it's been initialized, null if not.

Related Topics

ShoppingCartAttributeLoader.getPipelineSession(HttpServletRequest)
ShoppingCartAttributeLoader.getShoppingCart(Object)


getShoppingCartGetNames() Method

protected String[] getShoppingCartGetNames()
Return the list of names of PipelineSession attributes to try to find the shopping cart at.

This object will use the first shopping cart found.

Defaults to an array containing

Subclasses can override to return a different list of names to check.

"wlcs_shoppingCart".


getShoppingCartNamespace(Object) Method

protected String getShoppingCartNamespace(Object session)
throws Exception
Return the PipelineSession namespace to check for the shopping cart in.

This returns the PipelineSession's default namespace, but subclasses can override this.

Exceptions

Exception

getShoppingCartSetName() Method

protected String getShoppingCartSetName()
Return the name of the attribute in the p13n Request to set the ShoppingCart to.

Defaults to "wlcs_shoppingCart".

Subclasses can override this to return something else.


loadAttributes(Request, HttpServletRequest) Method

public void loadAttributes(Request request, 
                           HttpServletRequest origRequest)
Load the shopping cart from the original request to the new request.

Parameters

request
the p13n destination request.
origRequest
the http source request.

Related Topics

ShoppingCartAttributeLoader.getShoppingCart(Object)