Class ContentResolverEndpoint
java.lang.Object
com.broadleafcommerce.asset.web.endpoint.ContentResolverEndpoint
@FrameworkRestController
@FrameworkMapping({"${broadleaf.asset.internal.contentResolverEndpointPath}/**","${broadleaf.asset.internal.content-resolver-endpoint-path}/**"})
@DataRouteByExample(Asset.class)
public class ContentResolverEndpoint
extends Object
- Author:
- Samarth Dhruva (samarthd)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContentResolverEndpoint
(ContentResolverService contentResolverService, InternalAssetProperties internalAssetProperties, AssetService<Asset> service, jakarta.activation.FileTypeMap mimeFileTypeMap, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyBrowserCachingHeaders
(org.springframework.http.ResponseEntity.BodyBuilder responseBuilder) protected void
applyContentDisposition
(ResourceWithMetadata resourceWithMetadata, org.springframework.http.ResponseEntity.BodyBuilder responseBuilder, Asset asset) protected void
applyContentDisposition
(org.springframework.core.io.Resource resource, org.springframework.http.ResponseEntity.BodyBuilder responseBuilder, Asset asset) Deprecated, for removal: This API element is subject to removal in a future version.protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application>
protected org.springframework.http.HttpHeaders
protected org.springframework.http.CacheControl
protected ContentResolverService
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
getContextInfoFromRequest
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, jakarta.servlet.http.HttpServletRequest request) Check if the contextInfo passed in is missing any relevant information.protected void
protected jakarta.activation.FileTypeMap
org.springframework.http.ResponseEntity<org.springframework.core.io.Resource>
getResource
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.util.MultiValueMap<String, String> imageEffectsTags, jakarta.servlet.http.HttpServletRequest request) protected AssetService<Asset>
protected com.broadleafcommerce.common.extension.TypeFactory
org.springframework.http.ResponseEntity<com.broadleafcommerce.common.error.ApiError>
handleResourceResolutionException
(ResourceResolutionException ex, org.springframework.web.context.request.WebRequest request) void
init()
protected void
void
setTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) protected String
stripEndpointPrefix
(jakarta.servlet.http.HttpServletRequest request)
-
Field Details
-
CONTEXT_REQUEST_PARAM
- See Also:
-
-
Constructor Details
-
ContentResolverEndpoint
public ContentResolverEndpoint(ContentResolverService contentResolverService, InternalAssetProperties internalAssetProperties, AssetService<Asset> service, jakarta.activation.FileTypeMap mimeFileTypeMap, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService)
-
-
Method Details
-
init
@PostConstruct public void init() -
getInitUrlPathHelper
protected void getInitUrlPathHelper() -
getResource
@FrameworkGetMapping public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> getResource(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @RequestParam(required=false) org.springframework.util.MultiValueMap<String, String> imageEffectsTags, jakarta.servlet.http.HttpServletRequest request) -
getContextInfoFromRequest
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo getContextInfoFromRequest(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, jakarta.servlet.http.HttpServletRequest request) Check if the contextInfo passed in is missing any relevant information. If so, try to resolve the current application based on the request that came in.- Parameters:
contextInfo
- the context of the requestrequest
- the actual request that is being consumed- Returns:
- either the original contextInfo or a new one based on the resolved application
-
stripEndpointPrefix
-
applyBrowserCachingHeaders
protected void applyBrowserCachingHeaders(org.springframework.http.ResponseEntity.BodyBuilder responseBuilder) -
getCacheControl
protected org.springframework.http.CacheControl getCacheControl() -
getBackwardsCompatibleCachingHeaders
protected org.springframework.http.HttpHeaders getBackwardsCompatibleCachingHeaders() -
handleResourceResolutionException
@ExceptionHandler(ResourceResolutionException.class) public org.springframework.http.ResponseEntity<com.broadleafcommerce.common.error.ApiError> handleResourceResolutionException(ResourceResolutionException ex, org.springframework.web.context.request.WebRequest request) -
logDebug
-
applyContentDisposition
@Deprecated(since="2.1.0", forRemoval=true) protected void applyContentDisposition(org.springframework.core.io.Resource resource, org.springframework.http.ResponseEntity.BodyBuilder responseBuilder, Asset asset) Deprecated, for removal: This API element is subject to removal in a future version. -
applyContentDisposition
protected void applyContentDisposition(ResourceWithMetadata resourceWithMetadata, org.springframework.http.ResponseEntity.BodyBuilder responseBuilder, Asset asset) -
getContentResolverService
-
getService
-
getMimeFileTypeMap
@NonNull protected jakarta.activation.FileTypeMap getMimeFileTypeMap() -
getApplicationService
protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> getApplicationService() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
applyContentDisposition(ResourceWithMetadata, ResponseEntity.BodyBuilder, Asset)