org.apache.cayenne.configuration.web

## Class WebConfiguration

- java.lang.Object
- - org.apache.cayenne.configuration.web.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 Summary

    Constructors
    Constructor and Description
    `WebConfiguration(javax.servlet.FilterConfig filterConfiguration)`
    `WebConfiguration(javax.servlet.ServletConfig servletConfiguration)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<Module>` | `createModules(Module... standardModules)` Creates and returns a collection of modules made of provided standard modules and extra custom modules specified via an optional "extra-modules" init parameter.
    `String` | `getConfigurationLocation()` Returns a non-null location of an XML Cayenne configuration, extracted from the filter or servlet configuration parameters.
    `Map<String,String>` | `getOtherParameters()` Returns servlet or filter init parameters, excluding those recognized by WebConfiguration.
    `Map<String,String>` | `getParameters()` Returns a map of all init parameters from the underlying FilterConfig or ServletConfig object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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.

    - #### createModules

          public Collection<Module> createModules(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.

Copyright © 2001–2023 Apache Cayenne. All rights reserved.