Class DefaultContentResolver

java.lang.Object
com.broadleafcommerce.asset.storage.provider.service.DefaultContentResolver
All Implemented Interfaces:
ContentResolverService

public class DefaultContentResolver extends Object implements ContentResolverService

Default implementation of ContentResolverService. It uses StorageProvider to read the resources for the Assets.

Author:
Samarth Dhruva (samarthd)
  • Constructor Details

  • Method Details

    • readResourceWithMetadata

      public Optional<ResourceWithMetadata> readResourceWithMetadata(@NonNull @NonNull String url, @Nullable org.springframework.util.MultiValueMap<String,String> imageEffectsTags, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentResolverService

      This method will accept a URL and then return a handle to stream the resource from the StorageProvider.

      If the content is requested with certain effects applied, the method will search for a cached copy of the content with those effects applied. If no cached copy is found, then the base content is retrieved, the effects are applied to it, the modified version is cached in the storage provider, and then returned. Of course, if the base content is not found, this method will simply return an Optional.empty().

      Specified by:
      readResourceWithMetadata in interface ContentResolverService
      Parameters:
      url - the URL of the digital content to fetch
      imageEffectsTags - the image effects tags to apply to the content; a map of effects to their values.
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      an Optional containing the ResourceWithMetadata, or Optional.empty() if not found
    • doWithoutCache

      protected <R> R doWithoutCache(Supplier<R> returningWork)
    • createImageEffectsUrl

      protected String createImageEffectsUrl(String url, org.springframework.util.MultiValueMap<String,String> imageEffectsTags)
    • getStorageProvider

      protected StorageProvider getStorageProvider()
    • getImageOperationService

      protected ImageOperationService getImageOperationService()
    • getAssetStorageUtils

      protected AssetStorageUtils getAssetStorageUtils()