@Component(value="blCartStateFilter") @ConditionalOnNotAdmin public class CartStateFilter extends AbstractIgnorableOncePerRequestFilter
This filter should be configured after the BroadleafCommerce CustomerStateFilter listener from Spring Security. Retrieves the cart for the current BroadleafCommerce Customer based using the authenticated user OR creates an empty non-modifiable cart and stores it in the request.
This filter is also responsible for establishing a session-wide lock for operations that require a lock, indicated
by requestRequiresLock(ServletRequest). By default, this is configured for all POST requests. Requests that
are marked as requiring a lock will execute strictly serially as defined by the configured OrderLockManager.
| Modifier and Type | Field and Description |
|---|---|
protected CartStateRequestProcessor |
cartStateProcessor |
protected List<String> |
excludedOrderLockRequestPatterns |
protected static org.apache.commons.logging.Log |
LOG |
protected OrderLockManager |
orderLockManager |
protected OrderService |
orderService |
| Constructor and Description |
|---|
CartStateFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
doFilterInternalUnlessIgnored(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain) |
protected boolean |
getErrorInsteadOfQueue() |
List<String> |
getExcludedOrderLockRequestPatterns() |
int |
getOrder() |
protected boolean |
requestRequiresLock(javax.servlet.ServletRequest req)
By default, all POST requests that are not matched by the
getExcludedOrderLockRequestPatterns() list
(using the AntPathRequestMatcher) will be marked as requiring a lock on the Order. |
void |
setExcludedOrderLockRequestPatterns(List<String> excludedOrderLockRequestPatterns)
This allows you to declaratively set a list of excluded Request Patterns
|
protected boolean |
shouldNotFilterErrorDispatch() |
doFilterInternal, isIgnoreddoFilter, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatchprotected static final org.apache.commons.logging.Log LOG
@Autowired @Qualifier(value="blCartStateRequestProcessor") protected CartStateRequestProcessor cartStateProcessor
@Autowired @Qualifier(value="blOrderLockManager") protected OrderLockManager orderLockManager
@Autowired @Qualifier(value="blOrderService") protected OrderService orderService
public void doFilterInternalUnlessIgnored(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
doFilterInternalUnlessIgnored in class AbstractIgnorableOncePerRequestFilterIOExceptionjavax.servlet.ServletExceptionprotected boolean requestRequiresLock(javax.servlet.ServletRequest req)
getExcludedOrderLockRequestPatterns() list
(using the AntPathRequestMatcher) will be marked as requiring a lock on the Order.req - public int getOrder()
public void setExcludedOrderLockRequestPatterns(List<String> excludedOrderLockRequestPatterns)
protected boolean getErrorInsteadOfQueue()
protected boolean shouldNotFilterErrorDispatch()
shouldNotFilterErrorDispatch in class org.springframework.web.filter.OncePerRequestFilterCopyright © 2020. All rights reserved.