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  class Mapper.Context
           
protected  class Mapper.Host
           
protected  class Mapper.MapElement
           
protected  class Mapper.Wrapper
           
 
Field Summary
protected  java.lang.String defaultHostName
          Default host name.
protected  Mapper.Host[] hosts
          Array containing the virtual hosts definitions.
protected  boolean processWelcomeResources
          Flag indicating if physical welcome files are to be processed by this mapper.
 
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.Object host)
          Add a new host to the mapper.
 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.
 java.lang.String getDefaultHostName()
          Get default host.
 boolean getProcessWelcomeResources()
          Get flag value indicating whether or not welcome files are processed by the mapper.
static void main(java.lang.String[] args)
           
 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.
 void removeWrapper(java.lang.String hostName, java.lang.String contextPath, java.lang.String path)
          Remove a wrapper from an existing context.
 void setDefaultHostName(java.lang.String defaultHostName)
          Set default host.
 void setProcessWelcomeResources(boolean processWelcomeResources)
          Set the process flag indicating if welcome resources should be processed by the mapper.
 
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.


processWelcomeResources

protected boolean processWelcomeResources
Flag indicating if physical welcome files are to be processed by this mapper. Some default servlets may not want this, so this may be disabled here.

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.


getProcessWelcomeResources

public boolean getProcessWelcomeResources()
Get flag value indicating whether or not welcome files are processed by the mapper.

Returns:
Value of the processWelcomeResources flag

setProcessWelcomeResources

public void setProcessWelcomeResources(boolean processWelcomeResources)
Set the process flag indicating if welcome resources should be processed by the mapper. The default is true.

Parameters:
processWelcomeResources - True if welcome files should be fully processed by this mapper.

addHost

public void addHost(java.lang.String name,
                    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

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

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

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

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
java.lang.Exception

main

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


Copyright © 2001 Apache Software Foundation. All Rights Reserved.