org.apache.tomcat.util.http.mapper

## Class Mapper

- java.lang.Object
- - org.apache.tomcat.util.http.mapper.Mapper

-     public final class Mapper
      extends java.lang.Object

  Mapper, which implements the servlet API mapping rules (which are derived from the HTTP rules).
  Author:
    Remy Maucherat

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `Mapper.Context`
    `protected static class` | `Mapper.ContextList`
    `protected static class` | `Mapper.ContextVersion`
    `protected static class` | `Mapper.Host`
    `protected static class` | `Mapper.MapElement`
    `protected static class` | `Mapper.Wrapper`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Mapper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addContextVersion(java.lang.String hostName, java.lang.Object host, java.lang.String path, java.lang.String version, java.lang.Object context, java.lang.String[] welcomeResources, javax.naming.Context resources)` Deprecated. Use `addContextVersion(String, Object, String, String, Object, String[], javax.naming.Context, Collection, boolean, boolean)`
    `void` | `addContextVersion(java.lang.String hostName, java.lang.Object host, java.lang.String path, java.lang.String version, java.lang.Object context, java.lang.String[] welcomeResources, javax.naming.Context resources, java.util.Collection<WrapperMappingInfo> wrappers)` Deprecated. Use `addContextVersion(String, Object, String, String, Object, String[], javax.naming.Context, Collection, boolean, boolean)`
    `void` | `addContextVersion(java.lang.String hostName, java.lang.Object host, java.lang.String path, java.lang.String version, java.lang.Object context, java.lang.String[] welcomeResources, javax.naming.Context resources, java.util.Collection<WrapperMappingInfo> wrappers, boolean mapperContextRootRedirectEnabled, boolean mapperDirectoryRedirectEnabled)` Add a new Context to an existing Host.
    `void` | `addHost(java.lang.String name, java.lang.String[] aliases, java.lang.Object host)` Add a new host to the mapper.
    `void` | `addHostAlias(java.lang.String name, java.lang.String alias)` Add an alias to an existing host.
    `void` | `addWelcomeFile(java.lang.String hostName, java.lang.String contextPath, java.lang.String version, java.lang.String welcomeFile)` Add a welcome file to the given context.
    `protected void` | `addWrapper(Mapper.ContextVersion context, java.lang.String path, java.lang.Object wrapper, boolean jspWildCard, boolean resourceOnly)` Adds a wrapper to the given context.
    `void` | `addWrapper(java.lang.String path, java.lang.Object wrapper, boolean jspWildCard, boolean resourceOnly)`
    `void` | `addWrapper(java.lang.String hostName, java.lang.String contextPath, java.lang.String version, java.lang.String path, java.lang.Object wrapper, boolean jspWildCard, boolean resourceOnly)`
    `void` | `addWrappers(java.lang.String hostName, java.lang.String contextPath, java.lang.String version, java.util.Collection<WrapperMappingInfo> wrappers)`
    `void` | `clearWelcomeFiles(java.lang.String hostName, java.lang.String contextPath, java.lang.String version)` Clear the welcome files for the given context.
    `void` | `map(MessageBytes uri, MappingData mappingData)` Map the specified URI relative to the context, mutating the given mapping data.
    `void` | `map(MessageBytes host, MessageBytes uri, java.lang.String version, MappingData mappingData)` Map the specified host name and URI, mutating the given mapping data.
    `void` | `pauseContextVersion(java.lang.Object ctxt, java.lang.String hostName, java.lang.String contextPath, java.lang.String version)` Mark a context as being reloaded.
    `void` | `removeContextVersion(java.lang.String hostName, java.lang.String path, java.lang.String version)` Remove a context from an existing host.
    `void` | `removeHost(java.lang.String name)` Remove a host from the mapper.
    `void` | `removeHostAlias(java.lang.String alias)` Remove a host alias
    `void` | `removeWelcomeFile(java.lang.String hostName, java.lang.String contextPath, java.lang.String version, java.lang.String welcomeFile)` Remove a welcome file from the given context.
    `protected void` | `removeWrapper(Mapper.ContextVersion context, java.lang.String path)`
    `void` | `removeWrapper(java.lang.String path)` Remove a wrapper from the context associated with this wrapper.
    `void` | `removeWrapper(java.lang.String hostName, java.lang.String contextPath, java.lang.String version, java.lang.String path)` Remove a wrapper from an existing context.
    `void` | `setContext(java.lang.String path, java.lang.String[] welcomeResources, javax.naming.Context resources)` Set context, used for wrapper mapping (request dispatcher).
    `void` | `setDefaultHostName(java.lang.String defaultHostName)` Set default host.

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

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

- - ### Constructor Detail

    - #### Mapper

          public Mapper()

  - ### Method Detail

    - #### setDefaultHostName

          public void setDefaultHostName(java.lang.String defaultHostName)

      Set default host.
      Parameters:
        `defaultHostName` - Default host name

    - #### addHost

          public void addHost(java.lang.String name,
                     java.lang.String[] aliases,
                     java.lang.Object host)

      Add a new host to the mapper.
      Parameters:
        `name` - Virtual host name
        `aliases` - Alias names for the virtual host
        `host` - Host object

    - #### removeHost

          public void removeHost(java.lang.String name)

      Remove a host from the mapper.
      Parameters:
        `name` - Virtual host name

    - #### addHostAlias

          public void addHostAlias(java.lang.String name,
                          java.lang.String alias)

      Add an alias to an existing host.
      Parameters:
        `name` - The name of the host
        `alias` - The alias to add

    - #### removeHostAlias

          public void removeHostAlias(java.lang.String alias)

      Remove a host alias
      Parameters:
        `alias` - The alias to remove

    - #### setContext

          public void setContext(java.lang.String path,
                        java.lang.String[] welcomeResources,
                        javax.naming.Context resources)

      Set context, used for wrapper mapping (request dispatcher).
      Parameters:
        `welcomeResources` - Welcome files defined for this context
        `resources` - Static resources of the context

    - #### addContextVersion

          @Deprecated
          public void addContextVersion(java.lang.String hostName,
                                          java.lang.Object host,
                                          java.lang.String path,
                                          java.lang.String version,
                                          java.lang.Object context,
                                          java.lang.String[] welcomeResources,
                                          javax.naming.Context resources)

      Deprecated. Use `addContextVersion(String, Object, String, String, Object, String[], javax.naming.Context, Collection, boolean, boolean)`
      Add a new Context to an existing Host.
      Parameters:
        `hostName` - Virtual host name this context belongs to
        `host` - Host object
        `path` - Context path
        `version` - Context version
        `context` - Context object
        `welcomeResources` - Welcome files defined for this context
        `resources` - Static resources of the context

    - #### addContextVersion

          @Deprecated
          public void addContextVersion(java.lang.String hostName,
                                          java.lang.Object host,
                                          java.lang.String path,
                                          java.lang.String version,
                                          java.lang.Object context,
                                          java.lang.String[] welcomeResources,
                                          javax.naming.Context resources,
                                          java.util.Collection<WrapperMappingInfo> wrappers)

      Deprecated. Use `addContextVersion(String, Object, String, String, Object, String[], javax.naming.Context, Collection, boolean, boolean)`
      Add a new Context to an existing Host.
      Parameters:
        `hostName` - Virtual host name this context belongs to
        `host` - Host object
        `path` - Context path
        `version` - Context version
        `context` - Context object
        `welcomeResources` - Welcome files defined for this context
        `resources` - Static resources of the context
        `wrappers` - Information on wrapper mappings

    - #### addContextVersion

          public void addContextVersion(java.lang.String hostName,
                               java.lang.Object host,
                               java.lang.String path,
                               java.lang.String version,
                               java.lang.Object context,
                               java.lang.String[] welcomeResources,
                               javax.naming.Context resources,
                               java.util.Collection<WrapperMappingInfo> wrappers,
                               boolean mapperContextRootRedirectEnabled,
                               boolean mapperDirectoryRedirectEnabled)

      Add a new Context to an existing Host.
      Parameters:
        `hostName` - Virtual host name this context belongs to
        `host` - Host object
        `path` - Context path
        `version` - Context version
        `context` - Context object
        `welcomeResources` - Welcome files defined for this context
        `resources` - Static resources of the context
        `wrappers` - Information on wrapper mappings
        `mapperContextRootRedirectEnabled` - Mapper does context root redirects
        `mapperDirectoryRedirectEnabled` - Mapper does directory redirects

    - #### removeContextVersion

          public void removeContextVersion(java.lang.String hostName,
                                  java.lang.String path,
                                  java.lang.String version)

      Remove a context from an existing host.
      Parameters:
        `hostName` - Virtual host name this context belongs to
        `path` - Context path
        `version` - Context version

    - #### pauseContextVersion

          public void pauseContextVersion(java.lang.Object ctxt,
                                 java.lang.String hostName,
                                 java.lang.String contextPath,
                                 java.lang.String version)

      Mark a context as being reloaded. Reversion of this state is performed by calling `addContextVersion(...)` when context starts up.
      Parameters:
        `ctxt` - The actual context
        `hostName` - Virtual host name this context belongs to
        `contextPath` - Context path
        `version` - Context version

    - #### addWrapper

          public void addWrapper(java.lang.String hostName,
                        java.lang.String contextPath,
                        java.lang.String version,
                        java.lang.String path,
                        java.lang.Object wrapper,
                        boolean jspWildCard,
                        boolean resourceOnly)

    - #### addWrapper

          public void addWrapper(java.lang.String path,
                        java.lang.Object wrapper,
                        boolean jspWildCard,
                        boolean resourceOnly)

    - #### addWrappers

          public void addWrappers(java.lang.String hostName,
                         java.lang.String contextPath,
                         java.lang.String version,
                         java.util.Collection<WrapperMappingInfo> wrappers)

    - #### addWrapper

          protected void addWrapper(Mapper.ContextVersion context,
                        java.lang.String path,
                        java.lang.Object wrapper,
                        boolean jspWildCard,
                        boolean resourceOnly)

      Adds a wrapper to the given context.
      Parameters:
        `context` - The context to which to add the wrapper
        `path` - Wrapper mapping
        `wrapper` - The Wrapper object
        `jspWildCard` - true if the wrapper corresponds to the JspServlet and the mapping path contains a wildcard; false otherwise
        `resourceOnly` - true if this wrapper always expects a physical resource to be present (such as a JSP)

    - #### removeWrapper

          public void removeWrapper(java.lang.String path)

      Remove a wrapper from the context associated with this wrapper.
      Parameters:
        `path` - Wrapper mapping

    - #### removeWrapper

          public void removeWrapper(java.lang.String hostName,
                           java.lang.String contextPath,
                           java.lang.String version,
                           java.lang.String path)

      Remove a wrapper from an existing context.
      Parameters:
        `hostName` - Virtual host name this wrapper belongs to
        `contextPath` - Context path this wrapper belongs to
        `path` - Wrapper mapping

    - #### removeWrapper

          protected void removeWrapper(Mapper.ContextVersion context,
                           java.lang.String path)

    - #### addWelcomeFile

          public void addWelcomeFile(java.lang.String hostName,
                            java.lang.String contextPath,
                            java.lang.String version,
                            java.lang.String welcomeFile)

      Add a welcome file to the given context.
      Parameters:
        `hostName` -
        `contextPath` -
        `welcomeFile` -

    - #### removeWelcomeFile

          public void removeWelcomeFile(java.lang.String hostName,
                               java.lang.String contextPath,
                               java.lang.String version,
                               java.lang.String welcomeFile)

      Remove a welcome file from the given context.
      Parameters:
        `hostName` -
        `contextPath` -
        `welcomeFile` -

    - #### clearWelcomeFiles

          public void clearWelcomeFiles(java.lang.String hostName,
                               java.lang.String contextPath,
                               java.lang.String version)

      Clear the welcome files for the given context.
      Parameters:
        `hostName` -
        `contextPath` -

    - #### map

          public void map(MessageBytes host,
                 MessageBytes uri,
                 java.lang.String version,
                 MappingData mappingData)
                   throws java.lang.Exception

      Map the specified host name and URI, mutating the given mapping data.
      Parameters:
        `host` - Virtual host name
        `uri` - URI
        `mappingData` - This structure will contain the result of the mapping operation
      Throws:
        `java.lang.Exception`

    - #### map

          public void map(MessageBytes uri,
                 MappingData mappingData)
                   throws java.lang.Exception

      Map the specified URI relative to the context, mutating the given mapping data.
      Parameters:
        `uri` - URI
        `mappingData` - This structure will contain the result of the mapping operation
      Throws:
        `java.lang.Exception`

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