Class AbstractDecoratorMapper

java.lang.Object
com.opensymphony.module.sitemesh.mapper.AbstractDecoratorMapper
All Implemented Interfaces:
DecoratorMapper
Direct Known Subclasses:
AgentDecoratorMapper, ConfigDecoratorMapper, CookieDecoratorMapper, FileDecoratorMapper, FrameSetDecoratorMapper, InlineDecoratorMapper, LanguageDecoratorMapper, OSDecoratorMapper, PageDecoratorMapper, ParameterDecoratorMapper, PrintableDecoratorMapper, RobotDecoratorMapper, SessionDecoratorMapper

public abstract class AbstractDecoratorMapper extends Object implements DecoratorMapper
Abstract DecoratorMapper implementation for easy creation of new DecoratorMappers.

Typically, an implementation would override getNamedDecorator() or getDecorator(). If a Decorator cannot be returned from either of these, then they should delegate to their superclass.

Author:
Joe Walnes
See Also:
  • Field Details

    • parent

      protected DecoratorMapper parent
      Parent DecoratorMapper.
    • config

      protected Config config
      The config.
  • Constructor Details

    • AbstractDecoratorMapper

      public AbstractDecoratorMapper()
  • Method Details

    • init

      public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException
      Description copied from interface: DecoratorMapper
      Initialize the mapper. This is always called before the other methods.
      Specified by:
      init in interface DecoratorMapper
      Parameters:
      config - Config supplied by Servlet or Filter.
      properties - Any initialization properties (specific to implementation).
      parent - the parent
      Throws:
      InstantiationException - the instantiation exception
    • getDecorator

      public Decorator getDecorator(javax.servlet.http.HttpServletRequest request, Page page)
      Description copied from interface: DecoratorMapper
      Return appropriate Decorator for a certain Page.

      The implementation can determine the result based on the actual request or the data of the parsed page. Typically this would call getNamedDecorator() which would delegate to a parent DecoratorMapper.

      Specified by:
      getDecorator in interface DecoratorMapper
      Parameters:
      request - the request
      page - the page
      Returns:
      the decorator
    • getNamedDecorator

      public Decorator getNamedDecorator(javax.servlet.http.HttpServletRequest request, String name)
      Description copied from interface: DecoratorMapper
      Return a Decorator with given name.
      Specified by:
      getNamedDecorator in interface DecoratorMapper
      Parameters:
      request - the request
      name - the name
      Returns:
      the named decorator