Class ApplicationAssetProcessor
java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementModelProcessor
com.broadleafcommerce.auth.user.web.dialect.processor.ApplicationAssetProcessor
- All Implemented Interfaces:
org.thymeleaf.processor.element.IElementModelProcessor,org.thymeleaf.processor.element.IElementProcessor,org.thymeleaf.processor.IProcessor
@Component
public class ApplicationAssetProcessor
extends org.thymeleaf.processor.element.AbstractElementModelProcessor
Thymeleaf processor that handles the <blc:application-asset /> tag. This tag will be replaced
with an img tag containing the logo asset URL for the application associated with the given
client id. If no application is found, any content within the tag be used as fallback content.
Example:
<blc:application-asset />
Will be replaced with:
<img src="https://example.com/path/to/logo.png"/>
- Since:
- Authentication Service 2.3.0, Release Train 2.3.0
- Author:
- Jon Fleschler (jfleschler)
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationAssetProcessor(String dialectPrefix, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, com.broadleafcommerce.asset.consumer.jackson.AssetContentUrlResolver contentUrlResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoProcess(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IModel model, org.thymeleaf.processor.element.IElementModelStructureHandler structureHandler) protected Optional<Application>getApplicationForClient(AuthorizedClient authorizedClient) Get the application associated with the given authorized client.protected ApplicationService<Application>protected AuthorizedClientService<AuthorizedClient>protected com.broadleafcommerce.asset.consumer.jackson.AssetContentUrlResolverprotected voidinsertApplicationAssetTag(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IModel model, Application value) Insert an img tag with the logo asset URL into the model.Methods inherited from class org.thymeleaf.processor.element.AbstractElementModelProcessor
getDialectPrefix, getMatchingAttributeName, getMatchingElementName, processMethods inherited from class org.thymeleaf.processor.AbstractProcessor
getPrecedence, getTemplateModeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.thymeleaf.processor.IProcessor
getPrecedence, getTemplateMode
-
Constructor Details
-
ApplicationAssetProcessor
public ApplicationAssetProcessor(String dialectPrefix, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, com.broadleafcommerce.asset.consumer.jackson.AssetContentUrlResolver contentUrlResolver)
-
-
Method Details
-
doProcess
protected void doProcess(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IModel model, org.thymeleaf.processor.element.IElementModelStructureHandler structureHandler) - Specified by:
doProcessin classorg.thymeleaf.processor.element.AbstractElementModelProcessor
-
getApplicationForClient
Get the application associated with the given authorized client. If there is no application associated, return an empty optional.- Parameters:
authorizedClient- the authorized client- Returns:
- the application, if found
-
insertApplicationAssetTag
protected void insertApplicationAssetTag(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IModel model, Application value) Insert an img tag with the logo asset URL into the model.- Parameters:
context- the template contextmodel- the model to modifyvalue- the application containing the logo asset
-
getApplicationService
-
getClientService
-
getContentUrlResolver
protected com.broadleafcommerce.asset.consumer.jackson.AssetContentUrlResolver getContentUrlResolver()
-