org.apache.tomcat.util.http.mapper

Class 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
protected static classMapper.Context
protected static classMapper.ContextList
protected static classMapper.Host
protected abstract static classMapper.MapElement
protected static classMapper.Wrapper
Field Summary
protected Mapper.Contextcontext
Context associated with this wrapper, used for wrapper mapping.
protected StringdefaultHostName
Default host name.
protected Mapper.Host[]hosts
Array containing the virtual hosts definitions.
Method Summary
voidaddContext(String hostName, String path, Object context, String[] welcomeResources, Context resources)
Add a new Context to an existing Host.
voidaddHost(String name, String[] aliases, Object host)
Add a new host to the mapper.
voidaddHostAlias(String name, String alias)
Add an alias to an existing host.
voidaddWrapper(String hostName, String contextPath, String path, Object wrapper)
Add a new Wrapper to an existing Context.
voidaddWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard)
voidaddWrapper(String path, Object wrapper)
Add a wrapper to the context associated with this wrapper.
voidaddWrapper(String path, Object wrapper, boolean jspWildCard)
protected voidaddWrapper(Mapper.Context context, String path, Object wrapper)
protected voidaddWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard)
Adds a wrapper to the given context.
String[]getContextNames()
Return all contexts, in //HOST/PATH form
StringgetDefaultHostName()
Get default host.
String[]getHosts()
String[]getWrapperNames(String host, String context)
StringgetWrappersString(String host, String context)
voidmap(MessageBytes host, MessageBytes uri, MappingData mappingData)
Map the specified host name and URI, mutating the given mapping data.
voidmap(MessageBytes uri, MappingData mappingData)
Map the specified URI relative to the context, mutating the given mapping data.
voidremoveContext(String hostName, String path)
Remove a context from an existing host.
voidremoveHost(String name)
Remove a host from the mapper.
voidremoveHostAlias(String alias)
Remove a host alias
voidremoveWrapper(String path)
Remove a wrapper from the context associated with this wrapper.
voidremoveWrapper(String hostName, String contextPath, String path)
Remove a wrapper from an existing context.
protected voidremoveWrapper(Mapper.Context context, String path)
voidsetContext(String path, String[] welcomeResources, Context resources)
Set context, used for wrapper mapping (request dispatcher).
voidsetDefaultHostName(String defaultHostName)
Set default host.

Field Detail

context

protected Mapper.Context context
Context associated with this wrapper, used for wrapper mapping.

defaultHostName

protected String defaultHostName
Default host name.

hosts

protected Mapper.Host[] hosts
Array containing the virtual hosts definitions.

Method Detail

addContext

public void addContext(String hostName, String path, Object context, String[] welcomeResources, 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

addHost

public void addHost(String name, String[] aliases, Object host)
Add a new host to the mapper.

Parameters: name Virtual host name host Host object

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

addWrapper

public void addWrapper(String hostName, String contextPath, String path, 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(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard)

addWrapper

public void addWrapper(String path, Object wrapper)
Add a wrapper to the context associated with this wrapper.

Parameters: path Wrapper mapping wrapper The Wrapper object

addWrapper

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

addWrapper

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

addWrapper

protected void addWrapper(Mapper.Context context, String path, 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

getContextNames

public String[] getContextNames()
Return all contexts, in //HOST/PATH form

Returns: The context names

getDefaultHostName

public String getDefaultHostName()
Get default host.

Returns: Default host name

getHosts

public String[] getHosts()

getWrapperNames

public String[] getWrapperNames(String host, String context)

getWrappersString

public String getWrappersString(String host, String context)

map

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

map

public void map(MessageBytes uri, MappingData mappingData)
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

removeContext

public void removeContext(String hostName, String path)
Remove a context from an existing host.

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

removeHost

public void removeHost(String name)
Remove a host from the mapper.

Parameters: name Virtual host name

removeHostAlias

public void removeHostAlias(String alias)
Remove a host alias

Parameters: alias The alias to remove

removeWrapper

public void removeWrapper(String path)
Remove a wrapper from the context associated with this wrapper.

Parameters: path Wrapper mapping

removeWrapper

public void removeWrapper(String hostName, String contextPath, 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, String path)

setContext

public void setContext(String path, String[] welcomeResources, Context resources)
Set context, used for wrapper mapping (request dispatcher).

Parameters: welcomeResources Welcome files defined for this context resources Static resources of the context

setDefaultHostName

public void setDefaultHostName(String defaultHostName)
Set default host.

Parameters: defaultHostName Default host name

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