Class CartStateRequestProcessor

java.lang.Object
org.broadleafcommerce.common.web.AbstractBroadleafWebRequestProcessor
org.broadleafcommerce.core.web.order.security.CartStateRequestProcessor
All Implemented Interfaces:
BroadleafWebRequestProcessor

@Component("blCartStateRequestProcessor") public class CartStateRequestProcessor extends 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

  • 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, Order cart)
    • getOverrideCart

      public Order getOverrideCart(org.springframework.web.context.request.WebRequest request)
    • mergeCartNeeded

      public boolean mergeCartNeeded(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 Order mergeCart(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