public class Mapper extends Object
Modifier and Type | Class and Description |
---|---|
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 |
Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
Mapper() |
Modifier and Type | Method and Description |
---|---|
void |
addContext(String hostName,
String path,
Object context,
String[] welcomeResources,
NamingContext resources)
Add a new Context to an existing Host.
|
void |
addContext(String hostName,
String path,
Object context,
String[] welcomeResources,
NamingContext resources,
List<AlternateDocBase> alternateDocBases)
Add a new Context to an existing Host.
|
void |
addHost(String name,
String[] aliases,
Object host)
Add a new host to the mapper.
|
protected void |
addWrapper(Mapper.Context context,
String path,
Object wrapper) |
protected void |
addWrapper(Mapper.Context context,
String path,
Object wrapper,
boolean jspWildCard,
boolean isEmptyPathSpecial) |
protected void |
addWrapper(Mapper.Context context,
String path,
Object wrapper,
boolean jspWildCard,
String servletName,
boolean isEmptyPathSpecial)
Adds a wrapper to the given context.
|
void |
addWrapper(String path,
Object wrapper)
Add a wrapper to the context associated with this wrapper.
|
void |
addWrapper(String path,
Object wrapper,
boolean jspWildCard,
boolean isEmptyPathSpecial) |
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)
Add a new Wrapper to an existing Context.
|
void |
addWrapper(String hostName,
String contextPath,
String path,
Object wrapper,
boolean jspWildCard,
String servletName,
boolean isEmptyPathSpecial)
Add a new Wrapper to an existing Context.
|
static boolean |
allowReplacement()
true if replacement of already added [@link Host},
Mapper.Context and
Mapper.Wrapper when invoking addHost(java.lang.String, java.lang.String[], java.lang.Object) , addContext(java.lang.String, java.lang.String, java.lang.Object, java.lang.String[], org.glassfish.grizzly.http.server.naming.NamingContext) etc. |
String[] |
getContextNames()
Return all contexts, in //HOST/PATH form
|
String |
getDefaultHostName() |
String[] |
getHosts() |
int |
getPort() |
String[] |
getWrapperNames(String host,
String context) |
String |
getWrappersString(String host,
String context) |
void |
map(DataChunk host,
DataChunk 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 |
mapUriWithSemicolon(DataChunk serverName,
DataChunk decodedURI,
MappingData mappingData,
int semicolonPos)
Maps the decodedURI to the corresponding HttpHandler, considering that URI
may have a semicolon with extra data followed, which shouldn't be a part
of mapping process.
|
void |
removeContext(String hostName,
String path)
Remove a context from an existing host.
|
void |
removeHost(String name)
Remove a host from the mapper.
|
protected void |
removeWrapper(Mapper.Context context,
String path) |
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.
|
static void |
setAllowReplacement(boolean ar)
Allow replacement of already added
Mapper.Host , Mapper.Context and
Mapper.Wrapper when invoking addHost(java.lang.String, java.lang.String[], java.lang.Object) , addContext(java.lang.String, java.lang.String, java.lang.Object, java.lang.String[], org.glassfish.grizzly.http.server.naming.NamingContext) etc. |
void |
setContext(String path,
String[] welcomeResources,
NamingContext resources)
Set context, used for wrapper mapping (request dispatcher).
|
void |
setDefaultContextPath(String hostName,
String defaultContextPath)
Configures the given virtual server with the given default context path.
|
void |
setDefaultHostName(String defaultHostName)
Set default host.
|
void |
setPort(int port)
The Port this instance is used for mapping.
|
protected Mapper.Host[] hosts
protected String defaultHostName
protected Mapper.Context context
public static void setAllowReplacement(boolean ar)
Mapper.Host
, Mapper.Context
and
Mapper.Wrapper
when invoking addHost(java.lang.String, java.lang.String[], java.lang.Object)
, addContext(java.lang.String, java.lang.String, java.lang.Object, java.lang.String[], org.glassfish.grizzly.http.server.naming.NamingContext)
etc.
Default is falsepublic static boolean allowReplacement()
Mapper.Context
and
Mapper.Wrapper
when invoking addHost(java.lang.String, java.lang.String[], java.lang.Object)
, addContext(java.lang.String, java.lang.String, java.lang.Object, java.lang.String[], org.glassfish.grizzly.http.server.naming.NamingContext)
etc.
Default is falsepublic void setPort(int port)
public int getPort()
public String getDefaultHostName()
public void setDefaultHostName(String defaultHostName)
defaultHostName
- Default host namepublic void addHost(String name, String[] aliases, Object host)
name
- Virtual host namehost
- Host objectpublic void removeHost(String name)
name
- Virtual host namepublic String[] getHosts()
public void setContext(String path, String[] welcomeResources, NamingContext resources)
welcomeResources
- Welcome files defined for this contextresources
- Static resources of the contextpublic void addContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources)
hostName
- Virtual host name this context belongs topath
- Context pathcontext
- Context objectwelcomeResources
- Welcome files defined for this contextresources
- Static resources of the contextpublic void addContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources, List<AlternateDocBase> alternateDocBases)
hostName
- Virtual host name this context belongs topath
- Context pathcontext
- Context objectwelcomeResources
- Welcome files defined for this contextresources
- Static resources of the contextalternateDocBases
- the alternate docbases of the contextpublic void removeContext(String hostName, String path)
hostName
- Virtual host name this context belongs topath
- Context pathpublic String[] getContextNames()
public void addWrapper(String hostName, String contextPath, String path, Object wrapper)
hostName
- Virtual host name this wrapper belongs tocontextPath
- Context path this wrapper belongs topath
- Wrapper mappingwrapper
- Wrapper objectpublic void addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard)
hostName
- Virtual host name this wrapper belongs tocontextPath
- Context path this wrapper belongs topath
- Wrapper mappingwrapper
- Wrapper objectjspWildCard
- public void addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial)
hostName
- Virtual host name this wrapper belongs tocontextPath
- Context path this wrapper belongs topath
- Wrapper mappingwrapper
- Wrapper objectjspWildCard
- servletName
- servlet name or null if unknownpublic void addWrapper(String path, Object wrapper)
path
- Wrapper mappingwrapper
- The Wrapper objectpublic void addWrapper(String path, Object wrapper, boolean jspWildCard, boolean isEmptyPathSpecial)
protected void addWrapper(Mapper.Context context, String path, Object wrapper)
protected void addWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, boolean isEmptyPathSpecial)
protected void addWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial)
context
- The context to which to add the wrapperpath
- Wrapper mappingwrapper
- The Wrapper objectjspWildCard
- true if the wrapper corresponds to the JspServlet
and the mapping path contains a wildcard; false otherwiseservletName
- then name of servletName or null if unknownpublic void removeWrapper(String path)
path
- Wrapper mappingpublic void removeWrapper(String hostName, String contextPath, String path)
hostName
- Virtual host name this wrapper belongs tocontextPath
- Context path this wrapper belongs topath
- Wrapper mappingprotected void removeWrapper(Mapper.Context context, String path)
public void setDefaultContextPath(String hostName, String defaultContextPath) throws Exception
Exception
- if there is no web context deployed on the given
virtual server that matches the given default context pathpublic void mapUriWithSemicolon(DataChunk serverName, DataChunk decodedURI, MappingData mappingData, int semicolonPos) throws Exception
serverName
- the server name as described by the Host header.decodedURI
- decoded URImappingData
- MappingData
based on the URI.semicolonPos
- semicolon position. Might be 0 if position
wasn't resolved yet (so it will be resolved in the method),
or -1 if there is no semicolon in the URI.Exception
- if an error occurs mapping the requestpublic void map(DataChunk host, DataChunk uri, MappingData mappingData) throws Exception
host
- Virtual host nameuri
- URImappingData
- This structure will contain the result of the mapping
operationException
public void map(MessageBytes uri, MappingData mappingData) throws Exception
uri
- URImappingData
- This structure will contain the result of the mapping
operationException
Copyright © 2014 Oracle Corporation. All rights reserved.