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 Details

    • BLC_RULE_MAP_PARAM

      public static final String BLC_RULE_MAP_PARAM
      See Also:
    • OVERRIDE_CART_ATTR_NAME

      public static final String OVERRIDE_CART_ATTR_NAME
      See Also:
    • cartRequestAttributeName

      protected static String cartRequestAttributeName
    • anonymousCartSessionAttributeName

      protected static String anonymousCartSessionAttributeName
    • LOG

      protected final org.apache.commons.logging.Log LOG
      Logger for this class and subclasses
    • extensionManager

      protected CartStateRequestProcessorExtensionManager extensionManager
    • orderService

      protected org.broadleafcommerce.core.order.service.OrderService orderService
    • updateCartService

      protected UpdateCartService 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

      public static String getCartRequestAttributeName()
    • setCartRequestAttributeName

      public static void setCartRequestAttributeName(String cartRequestAttributeName)
    • 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