ConfigurationSource (Apache Tomcat 9.0.37 API Documentation)

org.apache.tomcat.util.file

## Interface ConfigurationSource

- All Known Implementing Classes:
    CatalinaBaseConfigurationSource

      public interface ConfigurationSource

  Abstracts configuration file storage. Allows Tomcat embedding using the regular configuration style. This abstraction aims to be very simple and does not cover resource listing, which is usually used for dynamic deployments that are usually not used when embedding, as well as resource writing.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ConfigurationSource.Resource` Represents a resource: a stream to the resource associated with its URI.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ConfigurationSource` | `DEFAULT`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default ConfigurationSource.Resource` | `getConfResource(String name)` Get a resource, based on the conf path.
    `ConfigurationSource.Resource` | `getResource(String name)` Get a resource, not based on the conf path.
    `default ConfigurationSource.Resource` | `getServerXml()` Returns the contents of the main conf/server.xml file.
    `default ConfigurationSource.Resource` | `getSharedWebXml()` Returns the contents of the shared conf/web.xml file.
    `URI` | `getURI(String name)` Get a URI to the given resource.

- - ### Field Detail

    - #### DEFAULT

          static final ConfigurationSource DEFAULT

  - ### Method Detail

    - #### getServerXml

          default ConfigurationSource.Resource getServerXml()
                                                     throws IOException

      Returns the contents of the main conf/server.xml file.
      Returns:
        the server.xml as an InputStream
      Throws:
        `IOException` - if an error occurs or if the resource does not exist

    - #### getSharedWebXml

          default ConfigurationSource.Resource getSharedWebXml()
                                                        throws IOException

      Returns the contents of the shared conf/web.xml file. This usually contains the declaration of the default and JSP servlets.
      Returns:
        the web.xml as an InputStream
      Throws:
        `IOException` - if an error occurs or if the resource does not exist

    - #### getConfResource

          default ConfigurationSource.Resource getConfResource(String name)
                                                        throws IOException

      Get a resource, based on the conf path.
      Parameters:
        `name` - The resource name
      Returns:
        the resource as an InputStream
      Throws:
        `IOException` - if an error occurs or if the resource does not exist

    - #### getResource

          ConfigurationSource.Resource getResource(String name)
                                            throws IOException

      Get a resource, not based on the conf path.
      Parameters:
        `name` - The resource name
      Returns:
        the resource
      Throws:
        `IOException` - if an error occurs or if the resource does not exist

    - #### getURI

          URI getURI(String name)

      Get a URI to the given resource. Unlike getResource, this will also return URIs to locations where no resource exists.
      Parameters:
        `name` - The resource name
      Returns:
        a URI representing the resource location

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.