Class WebConfiguration


  • public class WebConfiguration
    extends Object
    A class that provides access to common Cayenne web configuration parameters retrieved either from a FilterConfig or a ServletConfig configuration.
    Since:
    3.1
    • Constructor Detail

      • WebConfiguration

        public WebConfiguration​(javax.servlet.ServletConfig servletConfiguration)
      • WebConfiguration

        public WebConfiguration​(javax.servlet.FilterConfig filterConfiguration)
    • Method Detail

      • getConfigurationLocation

        public String getConfigurationLocation()
        Returns a non-null location of an XML Cayenne configuration, extracted from the filter or servlet configuration parameters.
      • getDataDomainName

        public String getDataDomainName()
        If you are using multiple configuration files (cayenne-*.xml) this allows you to specify a name for the data domain other than the default name "cayenne" (see ServerRuntimeBuilder). A specific data domain name is useful if you are setting database connection info using properties via PropertyDataSourceFactory.
        Since:
        4.1
      • createModules

        public Collection<org.apache.cayenne.di.Module> createModules​(org.apache.cayenne.di.Module... standardModules)
                                                               throws javax.servlet.ServletException
        Creates and returns a collection of modules made of provided standard modules and extra custom modules specified via an optional "extra-modules" init parameter. The value of the parameter is expected to be a comma or space-separated list of class names, with each class implementing Module interface. Each custom module must have a no-arg constructor. If a module of this type is already in the modules collection, such module is skipped.
        Throws:
        javax.servlet.ServletException
      • getParameters

        public Map<String,​String> getParameters()
        Returns a map of all init parameters from the underlying FilterConfig or ServletConfig object.
      • getOtherParameters

        public Map<String,​String> getOtherParameters()
        Returns servlet or filter init parameters, excluding those recognized by WebConfiguration. Namely 'configuration-location' and 'extra-modules' parameters are removed from the returned map.