External Asset represent digital content managed and stored via externally controlled systems about which the Asset Service has and needs no direct knowledge. In this case, the Asset Service only handles the metadata for digital content rather than uploading and storing actual files. Examples of this type of Asset include videos hosted on 3rd-party platforms like YouTube or Vimeo. External Asset could also be used in lieu of configuring a storage provider in Broadleaf to add links to images, for example, hosted on platforms like Google Cloud, Amazon S3, Azure, etc. However, this means that those images would have to be uploaded through those external platforms rather than through Broadleaf.
Internal Asset represent content managed and stored via an internally controlled system such as a local or shared filesystem or configured 3rd-party storage provider like Google Cloud, Amazon S3, Azure, etc. In this case, the Asset Service would handle both storing metadata and uploading and storing actual files in some storage provider.
These properties are specifically related to configuring how callers of the Asset Service actually access digital content represented by internal Asset
.
When an internal Asset
is saved for some content, only the relative path of the uploaded content is saved.
The rest of the URL is built dynamically using the following properties:
This property indicates what the base of the URL is that the Asset Service’s client should use in order to retrieve the actual digital content represented by a asset object.
The value of this property will be prefixed onto the asset’s stored URL when the Asset Service returns the Asset to the client and should be in the format scheme://domain:port/
.
This is useful when using a separate image domain or CDN to render content or when using CMSs that own the image part of your domain CNAME.
Usually, this property would equal something like https://my.cdn.com/
.
Then, in the CDN’s configuration, the origin server would point to the Asset Service endpoint responsible for resolving actual digital content requests (e.g., /content
, see the section on Content Resolver Endpoint Path).
However, if left blank, the servlet URL (i.e., request.scheme + request.domain + request.port + request.contextPath
: https://my-microservices.server.com/asset
) and content resolver endpoint path will be prefixed instead.
This property indicates the path to the Asset Service endpoint responsible for resolving actual digital content files.
By default, it is set to /content
, but any value set for it must begin with a forward slash (/
) but not end in one.
Note that it is not necessary to prefix the servlet context path (e.g., /asset
) to this value as that will be handled separately using the prependServletContextPath property.
If using a CDN, this path should be appended to the origin server URL after the full servlet URL, e.g., https://my-microservices.server.com/asset/content
.
Determines whether to prepend the request context path to the asset’s URL (Asset#url
) when
the API is generating the contentUrl
field for internal assets (DefaultAssetStorageType#INTERNAL
).
This property can be useful if the content resolution endpoint in the asset service itself is
behind a gateway or load-balancer with a particular request context path (e.g., "/api"), but
there’s a CDN configured and there is a desire to not have the request
context path in the CDN URL. In this scenario, prependRequestContextPath
would be set to
false, and instead the CDN’s origin server configuration would have the request context path.
This property is respected regardless of whether the contentProviderUrlPrefix
is blank.
The request context path will go immediately after the contentProviderUrlPrefix
(if it’s enabled).
Format:
contentProviderUrlPrefix[/requestContextPath][/servletContextPath[/contentResolverEndpointPath]]
This property only comes into play when a contentProviderUrlPrefix
is not blank.
It determines whether to also prepend the incoming request’s servlet context path (/asset
) to the Asset’s URL when the Asset Service returns Asset to the client.
Thus, if true and if contentProviderUrlPrefix
is not blank, the prefix onto the Asset’s URL would be contentProviderUrlPrefix/servletContextPath
or https://my.cdn.com/asset
.
If contentProviderUrlPrefix
is blank, then this property is ignored and the whole servlet URL is used as the base URL for the URL.
Tip
|
Servlet URL
The servlet URL is constructed based on the incoming request as so: |
Like prependServletContextPath, this property only comes into play when a contentProviderUrlPrefix
is not blank.
It determines whether to also prepend the contentResolverEndpointPath
(e.g., /content
) to the Asset’s URL when Asset are fetched.
Thus, if true and if contentProviderUrlPrefix
is not blank, the prefix onto the Asset’s URL would be contentProviderUrlPrefix/contentResolverEndpointPath
or https://my.cdn.com/content
.
Or, if prependServletContextPath
is also true, then the prefix would be contentProviderUrlPrefix/servletContextPath/contentResolverEndpointPath
or https://my.cdn.com/asset/content
.
If contentProviderUrlPrefix
is blank, then this property is ignored and the value of this property is appended to the Servlet URL (see previous section)