Class VersionValidatingRequestBodyAdvice
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
com.broadleafcommerce.cartoperation.web.advice.VersionValidatingRequestBodyAdvice
- All Implemented Interfaces:
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
@ControllerAdvice
public class VersionValidatingRequestBodyAdvice
extends org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
Request body advice which validates that the cart version is present and up to date for
CartVersionedRequests. Will also populate the version on the request body object if the
version comes from something other than the request body (e.g. header, cookie).- Author:
- Jacob Mitash
-
Constructor Summary
ConstructorsConstructorDescriptionVersionValidatingRequestBodyAdvice(CartHolder<com.broadleafcommerce.cart.client.domain.Cart> requestCartHolder, Set<CartVersionRequestValidator> validators, RequestCartVersionResolver requestCartVersionResolver, jakarta.servlet.http.HttpServletRequest request) -
Method Summary
Modifier and TypeMethodDescriptionafterBodyRead(Object body, org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type targetType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) protected jakarta.servlet.http.HttpServletRequestprotected CartHolder<com.broadleafcommerce.cart.client.domain.Cart>protected RequestCartVersionResolverprotected Set<CartVersionRequestValidator>booleansupports(org.springframework.core.MethodParameter methodParameter, Type targetType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) protected voidvalidateCartUpToDate(com.broadleafcommerce.cart.client.domain.Cart cart, CartVersionedRequest cartVersionedRequest) Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
beforeBodyRead, handleEmptyBodyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
determineReadHints
-
Constructor Details
-
VersionValidatingRequestBodyAdvice
public VersionValidatingRequestBodyAdvice(CartHolder<com.broadleafcommerce.cart.client.domain.Cart> requestCartHolder, Set<CartVersionRequestValidator> validators, RequestCartVersionResolver requestCartVersionResolver, jakarta.servlet.http.HttpServletRequest request)
-
-
Method Details
-
supports
-
afterBodyRead
@NonNull public Object afterBodyRead(@NonNull Object body, @NonNull org.springframework.http.HttpInputMessage inputMessage, @NonNull org.springframework.core.MethodParameter parameter, @NonNull Type targetType, @NonNull Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) - Specified by:
afterBodyReadin interfaceorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice- Overrides:
afterBodyReadin classorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter
-
validateCartUpToDate
protected void validateCartUpToDate(com.broadleafcommerce.cart.client.domain.Cart cart, CartVersionedRequest cartVersionedRequest) -
getRequestCartHolder
-
getValidators
-
getRequestCartVersionResolver
-
getRequest
protected jakarta.servlet.http.HttpServletRequest getRequest()
-