Top Description Inners Fields Constructors Methods
org.apache.catalina.mapper

public final Class Mapper

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .Arrays, .Collection, .List, .Map, java.util.concurrent.ConcurrentHashMap, .CopyOnWriteArrayList, jakarta.servlet.http.MappingMatch, org.apache.catalina.Context, .Host, .WebResource, .WebResourceRoot, .Wrapper, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.Ascii, .CharChunk, .MessageBytes, org.apache.tomcat.util.res.StringManager

Mapper, which implements the servlet API mapping rules (which are derived from the HTTP rules).
Author
Remy Maucherat

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class
protected abstract static class
protected static class
protected static class
protected static class

Field Summary

Modifier and TypeField and Description
private final Map<Context, Mapper.ContextVersion>
contextObjectToContextVersionMap

Mapping from Context object to Context version to support RequestDispatcher mappings.

private volatile Mapper.MappedHost
private volatile String
defaultHostName

Default host name.

pack-priv volatile Mapper.MappedHost[]
hosts

Array containing the virtual hosts definitions.

private static final Log
private static final StringManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addContextVersion(String
Virtual host name this context belongs to
hostName
,
Host
Host object
host
,
String
Context path
path
,
String
Context version
version
,
Context
Context object
context
,
String[]
Welcome files defined for this context
welcomeResources
,
WebResourceRoot
Static resources of the context
resources
,
Collection<WrapperMappingInfo>
Information on wrapper mappings
wrappers
)

Add a new Context to an existing Host.

public synchronized void
addHost(String
Virtual host name
name
,
String[]
Alias names for the virtual host
aliases
,
Host
Host object
host
)

Add a new host to the mapper.

public synchronized void
addHostAlias(String
The name of the host
name
,
String
The alias to add
alias
)

Add an alias to an existing host.

private synchronized boolean
public void
addWelcomeFile(String
The host where the given context can be found
hostName
,
String
The path of the given context
contextPath
,
String
The version of the given context
version
,
String
The welcome file to add
welcomeFile
)

Add a welcome file to the given context.

public void
addWrapper(String hostName, String contextPath, String version, String path, Wrapper wrapper, boolean jspWildCard, boolean resourceOnly)

protected void
addWrapper(Mapper.ContextVersion
The context to which to add the wrapper
context
,
String
Wrapper mapping
path
,
Wrapper
The Wrapper object
wrapper
,
boolean
true if the wrapper corresponds to the JspServlet and the mapping path contains a wildcard; false otherwise
jspWildCard
,
boolean
true if this wrapper always expects a physical resource to be present (such as a JSP)
resourceOnly
)

Adds a wrapper to the given context.

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

private void
addWrappers(Mapper.ContextVersion
The context to which to add the wrappers
contextVersion
,
Collection<WrapperMappingInfo>
Information on wrapper mappings
wrappers
)

Adds wrappers to the given context.

public void
clearWelcomeFiles(String
The host where the context to be cleared can be found
hostName
,
String
The path of the context to be cleared
contextPath
,
String
The version of the context to be cleared
version
)

Clear the welcome files for the given context.

private static int
compare(CharChunk name, int start, int end, String compareTo)

Compare given char chunk with String.

private static int
compareIgnoreCase(CharChunk name, int start, int end, String compareTo)

Compare given char chunk with String ignoring case.

private static <T, E extends Mapper.MapElement<T>> E
exactFind(E[] map, String name)

Find a map element given its name in a sorted array of map elements.

private static <T, E extends Mapper.MapElement<T>> E
exactFind(E[] map, CharChunk name)

Find a map element given its name in a sorted array of map elements.

private static <T, E extends Mapper.MapElement<T>> E
exactFindIgnoreCase(E[] map, CharChunk name)

Find a map element given its name in a sorted array of map elements.

private static <T> int
find(Mapper.MapElement<T>[] map, CharChunk name)

Find a map element given its name in a sorted array of map elements.

private static <T> int
find(Mapper.MapElement<T>[] map, CharChunk name, int start, int end)

Find a map element given its name in a sorted array of map elements.

private static <T> int
find(Mapper.MapElement<T>[] map, String name)

Find a map element given its name in a sorted array of map elements.

private Mapper.ContextVersion
findContextVersion(String hostName, String contextPath, String version, boolean silent)

private static <T> int
findIgnoreCase(Mapper.MapElement<T>[] map, CharChunk name)

Find a map element given its name in a sorted array of map elements.

private static <T> int
findIgnoreCase(Mapper.MapElement<T>[] map, CharChunk name, int start, int end)

Find a map element given its name in a sorted array of map elements.

private static <T> boolean
insertMap(Mapper.MapElement<T>[] oldMap, Mapper.MapElement<T>[] newMap, Mapper.MapElement<T> newElement)

Insert into the right place in a sorted MapElement array, and prevent duplicates.

private void
internalMap(CharChunk host, CharChunk uri, String version, MappingData mappingData)

Map the specified URI.

private void
internalMapExactWrapper(Mapper.MappedWrapper[] wrappers, CharChunk path, MappingData mappingData)

Exact mapping.

private void
internalMapExtensionWrapper(Mapper.MappedWrapper[]
Set of wrappers to check for matches
wrappers
,
CharChunk
Path to map
path
,
MappingData
Mapping data for result
mappingData
,
boolean
Is this mapping expecting to find a resource
resourceExpected
)

Extension mappings.

private void
internalMapWildcardWrapper(Mapper.MappedWrapper[] wrappers, int nesting, CharChunk path, MappingData mappingData)

Wildcard mapping.

private void
internalMapWrapper(Mapper.ContextVersion contextVersion, CharChunk path, MappingData mappingData)

Wrapper mapping.

private static int
lastSlash(CharChunk name)

Find the position of the last slash in the given char chunk.

public void
map(MessageBytes
Virtual host name
host
,
MessageBytes
URI
uri
,
String
The version, if any, included in the request to be mapped
version
,
MappingData
This structure will contain the result of the mapping operation
mappingData
)

Map the specified host name and URI, mutating the given mapping data.

public void
map(Context
The actual context
context
,
MessageBytes
URI
uri
,
MappingData
This structure will contain the result of the mapping operation
mappingData
)

Map the specified URI relative to the context, mutating the given mapping data.

private static int
nthSlash(CharChunk name, int n)

Find the position of the nth slash, in the given char chunk.

public void
pauseContextVersion(Context
The actual context
ctxt
,
String
Virtual host name this context belongs to
hostName
,
String
Context path
contextPath
,
String
Context version
version
)

Mark a context as being reloaded.

public void
removeContextVersion(Context
The actual context
ctxt
,
String
Virtual host name this context belongs to
hostName
,
String
Context path
path
,
String
Context version
version
)

Remove a context from an existing host.

public synchronized void
removeHost(String
Virtual host name
name
)

Remove a host from the mapper.

public synchronized void
removeHostAlias(String
The alias to remove
alias
)

Remove a host alias

private static <T> boolean
removeMap(Mapper.MapElement<T>[] oldMap, Mapper.MapElement<T>[] newMap, String name)

Insert into the right place in a sorted MapElement array.

public void
removeWelcomeFile(String
The host where the given context can be found
hostName
,
String
The path of the given context
contextPath
,
String
The version of the given context
version
,
String
The welcome file to remove
welcomeFile
)

Remove a welcome file from the given context.

public void
removeWrapper(String
Virtual host name this wrapper belongs to
hostName
,
String
Context path this wrapper belongs to
contextPath
,
String
Context version this wrapper belongs to
version
,
String
Wrapper mapping
path
)

Remove a wrapper from an existing context.

protected void
private static String
public synchronized void
setDefaultHostName(String
Default host name
defaultHostName
)

Set default host.

private static int
slashCount(String name)

Return the slash count in a given string.

private void
updateContextList(Mapper.MappedHost realHost, Mapper.ContextList newContextList)

Replace MappedHost#contextList field in realHost and all its aliases with a new value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait