Skip to content

Commit

Permalink
Allow custom tag rule bundles using Spring Boot autoconfiguration. Re…
Browse files Browse the repository at this point in the history
…name bundles -> tagRuleBundles
  • Loading branch information
codeconsole committed Oct 25, 2023
1 parent 408077f commit e736c6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spring:
sitemesh:
decorator:
metaTag: decorator
# bundles: sm2
# tagRuleBundles: org.sitemesh.content.tagrules.html.Sm2TagRuleBundle
exclusions: /assets/*
mappings:
- path: /*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.sitemesh.config.ConfigurableSiteMeshFilter;
import org.sitemesh.config.MetaTagBasedDecoratorSelector;
import org.sitemesh.config.RequestAttributeDecoratorSelector;
import org.sitemesh.content.tagrules.TagRuleBundle;
import org.sitemesh.content.tagrules.html.Sm2TagRuleBundle;
import org.sitemesh.webapp.WebAppContext;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -52,7 +53,7 @@ public void setMappings(List<HashMap<String, String>> mappings) {
private String prefix;
@Value("${sitemesh.decorator.metaTag:decorator}")
private String metaTagName;
@Value("${sitemesh.decorator.bundles:}")
@Value("${sitemesh.decorator.tagRuleBundles:}")
private List<String> bundles;
@Value("${sitemesh.decorator.attribute:}")
private String attribute;
Expand Down Expand Up @@ -87,9 +88,7 @@ protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
}
}
for (String bundle : bundles) {
if (bundle.trim().equals("sm2")) {
builder.addTagRuleBundle(new Sm2TagRuleBundle());
}
builder.addTagRuleBundle((TagRuleBundle) getObjectFactory().create(bundle));
}
builder.setIncludeErrorPages(includeErrorPages);
}
Expand Down

0 comments on commit e736c6a

Please sign in to comment.