Class CartStateRequestProcessor
java.lang.Object
org.broadleafcommerce.common.web.AbstractBroadleafWebRequestProcessor
org.broadleafcommerce.core.web.order.security.CartStateRequestProcessor
- All Implemented Interfaces:
org.broadleafcommerce.common.web.BroadleafWebRequestProcessor
@Component("blCartStateRequestProcessor")
public class CartStateRequestProcessor
extends org.broadleafcommerce.common.web.AbstractBroadleafWebRequestProcessor
Ensures that the customer's current cart is available to the request.
Also invokes blMergeCartProcessor" if the user has just logged in.
Genericized version of the CartStateFilter. This was made to facilitate reuse between Servlet Filters, Portlet Filters
and Spring MVC interceptors. Spring has an easy way of converting HttpRequests and PortletRequests into WebRequests
via
new ServletWebRequest(httpServletRequest); new PortletWebRequest(portletRequest);
For the interceptor pattern, you can simply implement a WebRequestInterceptor to invoke from there.
- Author:
- Phillip Verheyden
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Stringstatic final Stringprotected static Stringprotected org.broadleafcommerce.common.crossapp.service.CrossAppAuthServiceprotected org.broadleafcommerce.profile.web.core.security.CustomerStateRequestProcessorprotected final org.apache.commons.logging.LogLogger for this class and subclassesprotected org.broadleafcommerce.core.order.service.MergeCartServiceprotected org.broadleafcommerce.core.order.service.OrderServicestatic final Stringprotected UpdateCartService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringorg.broadleafcommerce.core.order.domain.OrdergetOverrideCart(org.springframework.web.context.request.WebRequest request) org.broadleafcommerce.core.order.domain.OrdermergeCart(org.broadleafcommerce.profile.core.domain.Customer customer, org.springframework.web.context.request.WebRequest request) Looks up the anonymous customer and merges that cart with the cart from the given logged in customer.booleanmergeCartNeeded(org.broadleafcommerce.profile.core.domain.Customer customer, org.springframework.web.context.request.WebRequest request) Returns true if the given customer is different than the previous anonymous customer, implying that this is the logged in customer and we need to merge the cartsvoidprocess(org.springframework.web.context.request.WebRequest request) static voidsetCartRequestAttributeName(String cartRequestAttributeName) protected voidupdateCartRequestAttributes(org.springframework.web.context.request.WebRequest request, org.broadleafcommerce.core.order.domain.Order cart) Methods inherited from class org.broadleafcommerce.common.web.AbstractBroadleafWebRequestProcessor
postProcess
-
Field Details
-
BLC_RULE_MAP_PARAM
- See Also:
-
OVERRIDE_CART_ATTR_NAME
- See Also:
-
cartRequestAttributeName
-
anonymousCartSessionAttributeName
-
LOG
protected final org.apache.commons.logging.Log LOGLogger for this class and subclasses -
extensionManager
-
orderService
protected org.broadleafcommerce.core.order.service.OrderService orderService -
updateCartService
-
mergeCartService
protected org.broadleafcommerce.core.order.service.MergeCartService mergeCartService -
customerStateRequestProcessor
protected org.broadleafcommerce.profile.web.core.security.CustomerStateRequestProcessor customerStateRequestProcessor -
crossAppAuthService
@Autowired(required=false) @Qualifier("blCrossAppAuthService") protected org.broadleafcommerce.common.crossapp.service.CrossAppAuthService crossAppAuthService
-
-
Constructor Details
-
CartStateRequestProcessor
public CartStateRequestProcessor()
-
-
Method Details
-
getCartRequestAttributeName
-
setCartRequestAttributeName
-
process
public void process(org.springframework.web.context.request.WebRequest request) -
updateCartRequestAttributes
protected void updateCartRequestAttributes(org.springframework.web.context.request.WebRequest request, org.broadleafcommerce.core.order.domain.Order cart) -
getOverrideCart
public org.broadleafcommerce.core.order.domain.Order getOverrideCart(org.springframework.web.context.request.WebRequest request) -
mergeCartNeeded
public boolean mergeCartNeeded(org.broadleafcommerce.profile.core.domain.Customer customer, org.springframework.web.context.request.WebRequest request) Returns true if the given customer is different than the previous anonymous customer, implying that this is the logged in customer and we need to merge the carts -
mergeCart
public org.broadleafcommerce.core.order.domain.Order mergeCart(org.broadleafcommerce.profile.core.domain.Customer customer, org.springframework.web.context.request.WebRequest request) Looks up the anonymous customer and merges that cart with the cart from the given logged in customer. This will also remove the customer from session after it has finished since it is no longer needed
-