# Class Mapper

java.lang.Object
org.apache.catalina.mapper.Mapper

public final class Mapper extends 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
Description
`protected static final class`
`Mapper.ContextList`
`protected static final class`
`Mapper.ContextVersion`
`protected static class`
`Mapper.MapElement<T>`
`protected static final class`
`Mapper.MappedContext`
`protected static final class`
`Mapper.MappedHost`
`protected static class`
`Mapper.MappedWrapper`

## Constructor Summary

Constructors
Constructor
Description
`Mapper()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addContextVersion(String hostName, Host host, String path, String version, Context context, String[] welcomeResources, WebResourceRoot resources, Collection<WrapperMappingInfo> wrappers)`
Add a new Context to an existing Host.
`void`
`addHost(String name, String[] aliases, Host host)`
Add a new host to the mapper.
`void`
`addHostAlias(String name, String alias)`
Add an alias to an existing host.
`void`
`addWelcomeFile(String hostName, String contextPath, String version, String welcomeFile)`
Add a welcome file to the given context.
`void`
`addWrapper(String hostName, String contextPath, String version, String path, Wrapper wrapper, boolean jspWildCard, boolean resourceOnly)`
`void`
`addWrappers(String hostName, String contextPath, String version, Collection<WrapperMappingInfo> wrappers)`
`void`
`clearWelcomeFiles(String hostName, String contextPath, String version)`
Clear the welcome files for the given context.
`void`
`map(Context context, MessageBytes uri, MappingData mappingData)`
Map the specified URI relative to the context, mutating the given mapping data.
`void`
`map(MessageBytes host, MessageBytes uri, String version, MappingData mappingData)`
Map the specified host name and URI, mutating the given mapping data.
`void`
`pauseContextVersion(Context ctxt, String hostName, String contextPath, String version)`
Mark a context as being reloaded.
`void`
`removeContextVersion(Context ctxt, String hostName, String path, String version)`
Remove a context from an existing host.
`void`
`removeHost(String name)`
Remove a host from the mapper.
`void`
`removeHostAlias(String alias)`
Remove a host alias
`void`
`removeWelcomeFile(String hostName, String contextPath, String version, String welcomeFile)`
Remove a welcome file from the given context.
`void`
`removeWrapper(String hostName, String contextPath, String version, String path)`
Remove a wrapper from an existing context.
`void`
`setDefaultHostName(String defaultHostName)`
Set default host.

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

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

## Constructor Details

### Mapper

public Mapper()

## Method Details

### setDefaultHostName

public void setDefaultHostName(String defaultHostName)
Set default host.

Parameters:
  `defaultHostName` - Default host name

### addHost

public void addHost(String name, String[] aliases, Host 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(String name)
Remove a host from the mapper.

Parameters:
  `name` - Virtual host name

### addHostAlias

public void addHostAlias(String name, 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(String alias)
Remove a host alias

Parameters:
  `alias` - The alias to remove

### addContextVersion

public void addContextVersion(String hostName, Host host, String path, String version, Context context, String[] welcomeResources, WebResourceRoot resources, Collection<WrapperMappingInfo> wrappers)
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

### removeContextVersion

public void removeContextVersion(Context ctxt, String hostName, String path, String version)
Remove a context from an existing host.

Parameters:
  `ctxt` - The actual context
  `hostName` - Virtual host name this context belongs to
  `path` - Context path
  `version` - Context version

### pauseContextVersion

public void pauseContextVersion(Context ctxt, String hostName, String contextPath, 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(String hostName, String contextPath, String version, String path, Wrapper wrapper, boolean jspWildCard, boolean resourceOnly)

### addWrappers

public void addWrappers(String hostName, String contextPath, String version, Collection<WrapperMappingInfo> wrappers)

### removeWrapper

public void removeWrapper(String hostName, String contextPath, String version, 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
  `version` - Context version this wrapper belongs to
  `path` - Wrapper mapping

### addWelcomeFile

public void addWelcomeFile(String hostName, String contextPath, String version, String welcomeFile)
Add a welcome file to the given context.

Parameters:
  `hostName` - The host where the given context can be found
  `contextPath` - The path of the given context
  `version` - The version of the given context
  `welcomeFile` - The welcome file to add

### removeWelcomeFile

public void removeWelcomeFile(String hostName, String contextPath, String version, String welcomeFile)
Remove a welcome file from the given context.

Parameters:
  `hostName` - The host where the given context can be found
  `contextPath` - The path of the given context
  `version` - The version of the given context
  `welcomeFile` - The welcome file to remove

### clearWelcomeFiles

public void clearWelcomeFiles(String hostName, String contextPath, String version)
Clear the welcome files for the given context.

Parameters:
  `hostName` - The host where the context to be cleared can be found
  `contextPath` - The path of the context to be cleared
  `version` - The version of the context to be cleared

### map

public void map(MessageBytes host, MessageBytes uri, String version, MappingData mappingData) throws IOException
Map the specified host name and URI, mutating the given mapping data.

Parameters:
  `host` - Virtual host name
  `uri` - URI
  `version` - The version, if any, included in the request to be mapped
  `mappingData` - This structure will contain the result of the mapping operation
Throws:
  `IOException` - if the buffers are too small to hold the results of the mapping.

### map

public void map(Context context, MessageBytes uri, MappingData mappingData) throws IOException
Map the specified URI relative to the context, mutating the given mapping data.

Parameters:
  `context` - The actual context
  `uri` - URI
  `mappingData` - This structure will contain the result of the mapping operation
Throws:
  `IOException` - if the buffers are too small to hold the results of the mapping.