Class DefaultContentResolver
java.lang.Object
com.broadleafcommerce.asset.storage.provider.service.DefaultContentResolver
- All Implemented Interfaces:
ContentResolverService
Default implementation of ContentResolverService
. It uses StorageProvider
to read
the resources for the Assets
.
- Author:
- Samarth Dhruva (samarthd)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultContentResolver
(StorageProvider storageProvider, ImageOperationService imageOperationService, AssetStorageUtils assetStorageUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
createImageEffectsUrl
(String url, org.springframework.util.MultiValueMap<String, String> imageEffectsTags) protected <R> R
doWithoutCache
(Supplier<R> returningWork) protected AssetStorageUtils
protected ImageOperationService
protected StorageProvider
readResourceWithMetadata
(@NonNull String url, org.springframework.util.MultiValueMap<String, String> imageEffectsTags, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method will accept a URL and then return a handle to stream the resource from theStorageProvider
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.asset.storage.provider.service.ContentResolverService
readResource
-
Constructor Details
-
DefaultContentResolver
public DefaultContentResolver(StorageProvider storageProvider, ImageOperationService imageOperationService, AssetStorageUtils assetStorageUtils)
-
-
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 interfaceContentResolverService
- Parameters:
url
- the URL of the digital content to fetchimageEffectsTags
- 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 theResourceWithMetadata
, orOptional.empty()
if not found
-
doWithoutCache
-
createImageEffectsUrl
-
getStorageProvider
-
getImageOperationService
-
getAssetStorageUtils
-