## 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
`protected static class` `Mapper.Context`
`protected static class` `Mapper.ContextList`
`protected static class` `Mapper.Host`
`protected static class` `Mapper.MapElement`
`protected static class` `Mapper.Wrapper`

Field Summary
`protected Mapper.Context` `context` Context associated with this wrapper, used for wrapper mapping.
`protected java.lang.String` `defaultHostName` Default host name.
`protected Mapper.Host[]` `hosts` Array containing the virtual hosts definitions.

Constructor Summary
`Mapper()`

Method Summary
`void` `addContext(java.lang.String hostName, java.lang.String path, java.lang.Object context, java.lang.String[] welcomeResources, javax.naming.Context resources)` 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.
`protected void` `addWrapper(Mapper.Context context, java.lang.String path, java.lang.Object wrapper)`
`protected void` `addWrapper(Mapper.Context context, java.lang.String path, java.lang.Object wrapper, boolean jspWildCard)` Adds a wrapper to the given context.
`void` `addWrapper(java.lang.String path, java.lang.Object wrapper)` Add a wrapper to the context associated with this wrapper.
`void` `addWrapper(java.lang.String path, java.lang.Object wrapper, boolean jspWildCard)`
`void` `addWrapper(java.lang.String hostName, java.lang.String contextPath, java.lang.String path, java.lang.Object wrapper)` Add a new Wrapper to an existing Context.
`void` `addWrapper(java.lang.String hostName, java.lang.String contextPath, java.lang.String path, java.lang.Object wrapper, boolean jspWildCard)`
`java.lang.String[]` `getContextNames()` Return all contexts, in //HOST/PATH form
`java.lang.String` `getDefaultHostName()` Get default host.
`java.lang.String[]` `getHosts()`
`java.lang.String[]` `getWrapperNames(java.lang.String host, java.lang.String context)`
`java.lang.String` `getWrappersString(java.lang.String host, java.lang.String context)`
`static void` `main(java.lang.String[] args)`
`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, MappingData mappingData)` Map the specified host name and URI, mutating the given mapping data.
`void` `removeContext(java.lang.String hostName, java.lang.String path)` Remove a context from an existing host.
`void` `removeHost(java.lang.String name)` Remove a host from the mapper.
`protected void` `removeWrapper(Mapper.Context 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 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`

Field Detail

### hosts

    protected Mapper.Host[] hosts

  Array containing the virtual hosts definitions.

### defaultHostName

    protected java.lang.String defaultHostName

  Default host name.

### context

    protected Mapper.Context context

  Context associated with this wrapper, used for wrapper mapping.

Constructor Detail

### Mapper

    public Mapper()

Method Detail

### getDefaultHostName

    public java.lang.String getDefaultHostName()

  Get default host.

  Returns:
    Default host name

### setDefaultHostName

    public void setDefaultHostName(java.lang.String defaultHostName)

  Set default host.

### 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
    `host` - Host object

### removeHost

    public void removeHost(java.lang.String name)

  Remove a host from the mapper.

  Parameters:
    `name` - Virtual host name

### getHosts

    public java.lang.String[] getHosts()

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

### addContext

    public void addContext(java.lang.String hostName,
                           java.lang.String path,
                           java.lang.Object context,
                           java.lang.String[] welcomeResources,
                           javax.naming.Context resources)

  Add a new Context to an existing Host.

  Parameters:
    `hostName` - Virtual host name this context belongs to
    `path` - Context path
    `context` - Context object
    `welcomeResources` - Welcome files defined for this context
    `resources` - Static resources of the context

### removeContext

    public void removeContext(java.lang.String hostName,
                              java.lang.String path)

  Remove a context from an existing host.

  Parameters:
    `hostName` - Virtual host name this context belongs to
    `path` - Context path

### getContextNames

    public java.lang.String[] getContextNames()

  Return all contexts, in //HOST/PATH form

  Returns:

### addWrapper

    public void addWrapper(java.lang.String hostName,
                           java.lang.String contextPath,
                           java.lang.String path,
                           java.lang.Object wrapper)

  Add a new Wrapper to an existing Context.

  Parameters:
    `hostName` - Virtual host name this wrapper belongs to
    `contextPath` - Context path this wrapper belongs to
    `path` - Wrapper mapping
    `wrapper` - Wrapper object

### addWrapper

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

### addWrapper

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

  Add a wrapper to the context associated with this wrapper.

  Parameters:
    `path` - Wrapper mapping
    `wrapper` - The Wrapper object

### addWrapper

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

### addWrapper

    protected void addWrapper(Mapper.Context context,
                              java.lang.String path,
                              java.lang.Object wrapper)

### addWrapper

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

  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

### 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 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.Context context,
                                 java.lang.String path)

### getWrappersString

    public java.lang.String getWrappersString(java.lang.String host,
                                              java.lang.String context)

### getWrapperNames

    public java.lang.String[] getWrapperNames(java.lang.String host,
                                              java.lang.String context)

### map

    public void map(MessageBytes host,
                    MessageBytes uri,
                    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`

### main

    public static void main(java.lang.String[] args)

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