Class OSDecoratorMapper

java.lang.Object
com.opensymphony.module.sitemesh.mapper.AbstractDecoratorMapper
com.opensymphony.module.sitemesh.mapper.OSDecoratorMapper
All Implemented Interfaces:
DecoratorMapper

public class OSDecoratorMapper extends AbstractDecoratorMapper
The OSDecoratorMapper will map a suitable decorator based on the operating system of the remote client.

OSDecoratorMapper works by checking to see if the "UA-OS" header was sent with the HTTP request. If it was, the class will check the value of the header with all the different os's the user has configured the Decorator Mapper to identify and, if a match is found, routes the request accordingly. Configuration is done using the sitemesh.xml file. The param name is a string literal (operating system name) you would like to match in the UA-OS header, and the value is what will be appended to the decorator name if the user is using that operating system

Version:
$Revision: 1.4 $
Author:
Adam P. Schepis
See Also:
  • Field Details

    • properties

      protected Properties properties
      Properties holds the parameters that the object was initialized with.
  • Constructor Details

    • OSDecoratorMapper

      public OSDecoratorMapper()
  • Method Details

    • init

      public void init(Config config, Properties properties, DecoratorMapper parent) throws InstantiationException
      Init initializes the OSDecoratorMapper object by setting the parent DecoratorMapper, and loading the initialization properties.
      Specified by:
      init in interface DecoratorMapper
      Overrides:
      init in class AbstractDecoratorMapper
      Parameters:
      config - The config file
      properties - An object containing intialization parameters
      parent - The parent DecoratorMapper object
      Throws:
      InstantiationException - should be thrown if the implementation cannot be initialized properly.
    • getDecorator

      public Decorator getDecorator(javax.servlet.http.HttpServletRequest request, Page page)
      Attempts to find the correct decorator for Page page based on the UA-OS HTTP header in the request.
      Specified by:
      getDecorator in interface DecoratorMapper
      Overrides:
      getDecorator in class AbstractDecoratorMapper
      Parameters:
      request - The HTTP request sent to the server
      page - The page SiteMesh is trying to find a decorator for
      Returns:
      A Decorator object that is either the decorator for the identified OS, or the parent DecoratorMapper's decorator