org.apache.tomcat.util.http.mapper
Class Mapper

java.lang.Object
  extended byorg.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.ContextList
           
protected  class Mapper.Host
           
protected  class Mapper.MapElement
           
protected  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.
protected  boolean processWelcomeResources
          Flag indicating if physical welcome files are to be processed by this mapper.
protected  boolean redirectDirectories
          Flag indicating that we should redirect to a directory when the URL doesn't end in a '/'.
 
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)
           
 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 hostName, java.lang.String contextPath, java.lang.String path, java.lang.Object wrapper)
          Add a new Wrapper to an existing Context.
 java.lang.String[] getContextNames()
          Return all contexts, in //HOST/PATH form
 java.lang.String getDefaultHostName()
          Get default host.
 java.lang.String[] getHosts()
           
 boolean getProcessWelcomeResources()
          Get flag value indicating whether or not welcome files are processed by the mapper.
 boolean getRedirectDirectories()
          Get the flag that indicates if we redirect to directories that don't end a '/'.
 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, java.lang.String[] aliases)
          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.
 void setProcessWelcomeResources(boolean processWelcomeResources)
          Set the process flag indicating if welcome resources should be processed by the mapper.
 void setRedirectDirectories(boolean rd)
          Set the flag that indicates if we redirect to directories that don't end in a '/'.
 
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.


redirectDirectories

protected boolean redirectDirectories
Flag indicating that we should redirect to a directory when the URL doesn't end in a '/'. It overrided the Authenticator, so the redirect done before authentication.


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.


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.

getRedirectDirectories

public boolean getRedirectDirectories()
Get the flag that indicates if we redirect to directories that don't end a '/'.


setRedirectDirectories

public void setRedirectDirectories(boolean rd)
Set the flag that indicates if we redirect to directories that don't end in a '/'.


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,
                       java.lang.String[] aliases)
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 path,
                       java.lang.Object wrapper)
Add a wrapper to the context associated with this wrapper.

Parameters:
path - Wrapper mapping

addWrapper

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

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.