Class SandboxVisibleCacheEnabledContextInfoCustomizer

  • All Implemented Interfaces:
    ContextInfoCustomizer, org.springframework.core.Ordered

    public class SandboxVisibleCacheEnabledContextInfoCustomizer
    extends Object
    implements ContextInfoCustomizer
    Establish the cache context for this request. This will aid in the determination of whether or not caches sensitive to CacheContext will be enabled. More specifically, disable the cache context if the current user is an admin user, or if the current request is a valid storefront preview request.
    Author:
    Jeff Fischer
    • Constructor Detail

      • SandboxVisibleCacheEnabledContextInfoCustomizer

        public SandboxVisibleCacheEnabledContextInfoCustomizer​(org.springframework.core.convert.converter.Converter<org.springframework.security.core.Authentication,​Map<String,​Object>> authenticationAttributesConverter)
    • Method Detail

      • customize

        public void customize​(@NonNull
                              ContextInfo contextInfo,
                              String routeKey,
                              org.springframework.core.MethodParameter endpoint,
                              org.springframework.web.context.request.NativeWebRequest webRequest)
        Description copied from interface: ContextInfoCustomizer
        Customize any of the settings on the passed in ContextInfo instance.
        Specified by:
        customize in interface ContextInfoCustomizer
        Parameters:
        contextInfo - The instance to customize
        routeKey - Analogous to the key identified by DataRouteByKey. Useful in restricting the influence of the customization to particular flows. For example, you could use this to limit customization to all catalog service flows by comparing this routeKey to the catalog service's RouteConstants.CATALOG_ROUTE_KEY. May be null if the ContextInfo is being customized from a non-standard location, or if data routing is not currently engaged for the flow.
        endpoint - The method that initiated the instantiation of this ContextInfo instance. You can use this value to limit customization to a particular endpoint class or method call by inspecting the attributes of this value. May be null if the ContextInfo is being customized from a non-standard location.
        webRequest - Web call related information. Can be used to inspect request context information in order to make arbitrary decisions regarding customization. May be null if the ContextInfo is being customized from a non-standard location.