org.apache.tomcat.util.http.mapper

Class 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 String
defaultHostName
Default host name.
protected Mapper.Host[]
hosts
Array containing the virtual hosts definitions.

Method Summary

void
addContext(String hostName, String path, Object context, String[] welcomeResources, javax.naming.Context resources)
Add a new Context to an existing Host.
void
addHost(String name, String[] aliases, Object host)
Add a new host to the mapper.
void
addWrapper(String path, Object wrapper)
Add a wrapper to the context associated with this wrapper.
void
addWrapper(String path, Object wrapper, boolean jspWildCard)
void
addWrapper(String hostName, String contextPath, String path, Object wrapper)
Add a new Wrapper to an existing Context.
void
addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard)
protected void
addWrapper(Mapper.Context context, String path, Object wrapper)
protected void
addWrapper(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
String
getDefaultHostName()
Get default host.
String[]
getHosts()
String[]
getWrapperNames(String host, String context)
String
getWrappersString(String host, String context)
static void
main(args[] )
void
map(MessageBytes host, MessageBytes uri, MappingData mappingData)
Map the specified host name and URI, mutating the given mapping data.
void
map(MessageBytes uri, MappingData mappingData)
Map the specified URI relative to the context, mutating the given mapping data.
void
removeContext(String hostName, String path)
Remove a context from an existing host.
void
removeHost(String name)
Remove a host from the mapper.
void
removeWrapper(String path)
Remove a wrapper from the context associated with this wrapper.
void
removeWrapper(String hostName, String contextPath, String path)
Remove a wrapper from an existing context.
protected void
removeWrapper(Mapper.Context context, String path)
void
setContext(String path, String[] welcomeResources, javax.naming.Context resources)
Set context, used for wrapper mapping (request dispatcher).
void
setDefaultHostName(String defaultHostName)
Set default host.

Field Details

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 Details

addContext

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


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


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

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

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:


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)


main

public static void main(args[] )


map

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


map

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


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


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


setDefaultHostName

public void setDefaultHostName(String defaultHostName)
Set default host.

Parameters:


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.