org.sitemesh.config
Class PathBasedDecoratorSelector<C extends SiteMeshContext>

java.lang.Object
  extended by org.sitemesh.config.PathBasedDecoratorSelector<C>
All Implemented Interfaces:
DecoratorSelector<C>

public class PathBasedDecoratorSelector<C extends SiteMeshContext>
extends Object
implements DecoratorSelector<C>

DecoratorSelector implementation that selects a decorator based on the incoming SiteMeshContext.getPath() and the mappings setup.

Example

 DecoratorSelector selector = new PathBasedDecoratorSelector()
      .put("/*", "/decorators/default.html")
      .put("/admin/*", "/decorators/admin.html")
      .put("/thingy", "/decorators/thingy.html")
 

Author:
Joe Walnes
See Also:
PathMapper

Constructor Summary
PathBasedDecoratorSelector()
           
 
Method Summary
 PathBasedDecoratorSelector put(String contentPath, String... decoratorPaths)
           
 String[] selectDecoratorPaths(Content content, C siteMeshContext)
          Implementations should never return null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathBasedDecoratorSelector

public PathBasedDecoratorSelector()
Method Detail

put

public PathBasedDecoratorSelector put(String contentPath,
                                      String... decoratorPaths)

selectDecoratorPaths

public String[] selectDecoratorPaths(Content content,
                                     C siteMeshContext)
                              throws IOException
Description copied from interface: DecoratorSelector
Implementations should never return null.

Specified by:
selectDecoratorPaths in interface DecoratorSelector<C extends SiteMeshContext>
Throws:
IOException


Copyright © 2011. All Rights Reserved.