Class ConfigLoader

java.lang.Object
com.opensymphony.module.sitemesh.mapper.ConfigLoader

public class ConfigLoader extends Object
The ConfigLoader reads a configuration XML file that contains Decorator definitions (name, url, init-params) and path-mappings (pattern, name).

These can then be accessed by the getDecoratorByName() methods and getMappedName() methods respectively.

The DTD for the configuration file in old (deprecated) format is located at http://www.opensymphony.com/dtds/sitemesh_1_0_decorators.dtd .

The DTD for the configuration file in new format is located at http://www.opensymphony.com/dtds/sitemesh_1_5_decorators.dtd .

Editing the config file will cause it to be auto-reloaded.

This class is used by ConfigDecoratorMapper, and uses PathMapper for pattern matching.

Author:
Joe Walnes, Mathias Bogaert
See Also:
  • Constructor Details

    • ConfigLoader

      public ConfigLoader(File configFile) throws javax.servlet.ServletException
      Create new ConfigLoader using supplied File.
      Parameters:
      configFile - the config file
      Throws:
      javax.servlet.ServletException - the servlet exception
    • ConfigLoader

      public ConfigLoader(String configFileName, Config config) throws javax.servlet.ServletException
      Create new ConfigLoader using supplied filename and config.
      Parameters:
      configFileName - the config file name
      config - the config
      Throws:
      javax.servlet.ServletException - the servlet exception
  • Method Details

    • getDecoratorByName

      public Decorator getDecoratorByName(String name) throws javax.servlet.ServletException
      Retrieve Decorator based on name specified in configuration file.
      Parameters:
      name - the name
      Returns:
      the decorator by name
      Throws:
      javax.servlet.ServletException - the servlet exception
    • getMappedName

      public String getMappedName(String path) throws javax.servlet.ServletException
      Get name of Decorator mapped to given path.
      Parameters:
      path - the path
      Returns:
      the mapped name
      Throws:
      javax.servlet.ServletException - the servlet exception