Class ContextRequestConverter

java.lang.Object
com.broadleafcommerce.data.tracking.core.web.ContextRequestConverter
All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<String,ContextRequest>, org.springframework.core.Ordered

public class ContextRequestConverter extends Object implements org.springframework.core.convert.converter.Converter<String,ContextRequest>, org.springframework.core.Ordered

Allows conversion of the X-Context-Request header json value into a ContextRequest instance. This is useful when specifying a @RequestHeader instance in a Spring rest controller method.

If the source is null, this returns an "empty" ContextRequest (non-null but no properties set)

Author:
Jeff Fischer
  • Constructor Details

    • ContextRequestConverter

      public ContextRequestConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, List<ContextRequestHydrator> hydrators, com.broadleafcommerce.common.extension.data.DataRouteReference reference)
  • Method Details

    • convert

      @NonNull public ContextRequest convert(String source)
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<String,ContextRequest>
    • validateRequestTenant

      protected void validateRequestTenant(@Nullable String tenantId, @Nullable String applicationId, @Nullable String catalogId, @Nullable String customerContextId)
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()