public MetaTagBasedDecoratorSelector put(String contentPath, String... decoratorPaths) { super.put(contentPath, decoratorPaths); return this; }
public String[] selectDecoratorPaths(Content content, C siteMeshContext) throws IOException { // Fetch <meta name=decorator> value. // The default HTML processor already extracts these into 'meta.NAME' properties. String decorator = content.getExtractedProperties() .getChild("meta") .getChild("decorator") .getValue(); if (decorator != null) { // If present, return it. // Multiple chained decorators can be specified using commas. return decorator.split(","); } // Otherwise, fallback to the standard configuration return super.selectDecoratorPaths(content, siteMeshContext); } }
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String exclusionPattern = getSelector().excludePatternInUse(request); if (exclusionPattern != null) { // Ability to override exclusion by more specific pattern if (decoratorSelector instanceof PathBasedDecoratorSelector) { PathBasedDecoratorSelector<WebAppContext> pbds = (PathBasedDecoratorSelector<WebAppContext>) decoratorSelector; String decoratorPattern = pbds.getPathMapper().getPatternInUse(WebAppContext.getRequestPath(request)); if(decoratorPattern == null) { // there is no decorator rule for this exclusion pattern filterChain.doFilter(request, response); return; } if(PathMapper.isMoreSpecific(exclusionPattern, decoratorPattern)){ // if the exclusion type is more specific filterChain.doFilter(request, response); return; } } } super.doFilter(servletRequest, servletResponse, filterChain); }
public String[] selectDecoratorPaths(Content content, C siteMeshContext) throws IOException { // Fetch <meta name=decorator> value. // The default HTML processor already extracts these into 'meta.NAME' properties. String decorator = content.getExtractedProperties() .getChild("meta") .getChild("decorator") .getValue(); if (decorator != null) { // If present, return it. // Multiple chained decorators can be specified using commas. return decorator.split(","); } // Otherwise, fallback to the standard configuration return super.selectDecoratorPaths(content, siteMeshContext); } }
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String exclusionPattern = getSelector().excludePatternInUse(request); if (exclusionPattern != null) { // Ability to override exclusion by more specific pattern if (decoratorSelector instanceof PathBasedDecoratorSelector) { PathBasedDecoratorSelector<WebAppContext> pbds = (PathBasedDecoratorSelector<WebAppContext>) decoratorSelector; String decoratorPattern = pbds.getPathMapper().getPatternInUse(WebAppContext.getRequestPath(request)); if(decoratorPattern == null) { // there is no decorator rule for this exclusion pattern filterChain.doFilter(request, response); return; } if(PathMapper.isMoreSpecific(exclusionPattern, decoratorPattern)){ // if the exclusion type is more specific filterChain.doFilter(request, response); return; } } } super.doFilter(servletRequest, servletResponse, filterChain); }
public MetaTagBasedDecoratorSelector put(String contentPath, String... decoratorPaths) { super.put(contentPath, decoratorPaths); return this; }
/** * Add multiple decorator paths to be used for a specific content path. Use this to apply multiple * decorators to a single page. * * <p>Note: If {@link #setCustomDecoratorSelector(DecoratorSelector)} is called, * any decorator paths are ignored, as they are only used by the default * DecoratorSelector implementation.</p> */ public BUILDER addDecoratorPaths(String contentPath, List<String> decoratorPaths) { pathBasedDecoratorSelector.put(contentPath, decoratorPaths.toArray(new String[decoratorPaths.size()])); return self(); }
/** * Add multiple decorator paths to be used for a specific content path. Use this to apply multiple * decorators to a single page. * * <p>Note: If {@link #setCustomDecoratorSelector(DecoratorSelector)} is called, * any decorator paths are ignored, as they are only used by the default * DecoratorSelector implementation.</p> */ public BUILDER addDecoratorPaths(String contentPath, String... decoratorPaths) { pathBasedDecoratorSelector.put(contentPath, decoratorPaths); return self(); }
/** * Add multiple decorator paths to be used for a specific content path. Use this to apply multiple * decorators to a single page. * * <p>Note: If {@link #setCustomDecoratorSelector(DecoratorSelector)} is called, * any decorator paths are ignored, as they are only used by the default * DecoratorSelector implementation.</p> */ public BUILDER addDecoratorPaths(String contentPath, String... decoratorPaths) { pathBasedDecoratorSelector.put(contentPath, decoratorPaths); return self(); }
/** * Add multiple decorator paths to be used for a specific content path. Use this to apply multiple * decorators to a single page. * * <p>Note: If {@link #setCustomDecoratorSelector(DecoratorSelector)} is called, * any decorator paths are ignored, as they are only used by the default * DecoratorSelector implementation.</p> */ public BUILDER addDecoratorPaths(String contentPath, List<String> decoratorPaths) { pathBasedDecoratorSelector.put(contentPath, decoratorPaths.toArray(new String[decoratorPaths.size()])); return self(); }