public class OSDecoratorMapper extends AbstractDecoratorMapper
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
AbstractDecoratorMapper
Modifier and Type | Field and Description |
---|---|
protected java.util.Properties |
properties
Properties holds the parameters that the object was initialized with.
|
config, parent
Constructor and Description |
---|
OSDecoratorMapper() |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
init(Config config,
java.util.Properties properties,
DecoratorMapper parent)
Init initializes the OSDecoratorMapper object by setting the parent
DecoratorMapper, and loading the initialization properties.
|
getNamedDecorator
protected java.util.Properties properties
public void init(Config config, java.util.Properties properties, DecoratorMapper parent) throws java.lang.InstantiationException
init
in interface DecoratorMapper
init
in class AbstractDecoratorMapper
config
- The config fileproperties
- An object containing intialization parametersparent
- The parent DecoratorMapper objectjava.lang.InstantiationException
- should be thrown if the implementation
cannot be initialized properly.public Decorator getDecorator(javax.servlet.http.HttpServletRequest request, Page page)
getDecorator
in interface DecoratorMapper
getDecorator
in class AbstractDecoratorMapper
request
- The HTTP request sent to the serverpage
- The page SiteMesh is trying to find a decorator for