Class Mapper
java.lang.Object
org.glassfish.grizzly.http.server.util.Mapper
Mapper, which implements the servlet API mapping rules (which are derived
from the HTTP rules).
- Author:
- Remy Maucherat
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classprotected static final classprotected static final classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Mapper.ContextContext associated with this wrapper, used for wrapper mapping.protected StringDefault host name.protected Mapper.Host[]Array containing the virtual hosts definitions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources) Add a new Context to an existing Host.voidaddContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources, List<AlternateDocBase> alternateDocBases) Add a new Context to an existing Host.voidAdd a new host to the mapper.voidaddWrapper(String path, Object wrapper) Add a wrapper to the context associated with this wrapper.voidaddWrapper(String path, Object wrapper, boolean jspWildCard, boolean isEmptyPathSpecial) voidaddWrapper(String hostName, String contextPath, String path, Object wrapper) Add a new Wrapper to an existing Context.voidaddWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard) Add a new Wrapper to an existing Context.voidaddWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial) Add a new Wrapper to an existing Context.protected voidaddWrapper(Mapper.Context context, String path, Object wrapper) protected voidaddWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, boolean isEmptyPathSpecial) protected voidaddWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial) Adds a wrapper to the given context.static booleantrue if replacement of already added [@link Host},Mapper.ContextandMapper.Wrapperwhen invokingaddHost(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[]Return all contexts, in //HOST/PATH formString[]getHosts()intgetPort()String[]getWrapperNames(String host, String context) getWrappersString(String host, String context) voidmap(org.glassfish.grizzly.http.HttpRequestPacket requestPacket, org.glassfish.grizzly.http.util.DataChunk uri, MappingData mappingData) Map the specified host name and URI, mutating the given mapping data.voidmap(org.glassfish.grizzly.http.util.DataChunk host, org.glassfish.grizzly.http.util.DataChunk uri, MappingData mappingData) Map the specified host name and URI, mutating the given mapping data.voidmap(org.glassfish.grizzly.http.util.MessageBytes uri, MappingData mappingData) Map the specified URI relative to the context, mutating the given mapping data.voidmapUriWithSemicolon(org.glassfish.grizzly.http.HttpRequestPacket requestPacket, org.glassfish.grizzly.http.util.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.voidmapUriWithSemicolon(org.glassfish.grizzly.http.util.DataChunk serverName, org.glassfish.grizzly.http.util.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.voidremoveContext(String hostName, String path) Remove a context from an existing host.voidremoveHost(String name) Remove a host from the mapper.voidremoveWrapper(String path) Remove a wrapper from the context associated with this wrapper.voidremoveWrapper(String hostName, String contextPath, String path) Remove a wrapper from an existing context.protected voidremoveWrapper(Mapper.Context context, String path) static voidsetAllowReplacement(boolean ar) Allow replacement of already addedMapper.Host,Mapper.ContextandMapper.Wrapperwhen invokingaddHost(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.voidsetContext(String path, String[] welcomeResources, NamingContext resources) Set context, used for wrapper mapping (request dispatcher).voidsetDefaultContextPath(String hostName, String defaultContextPath) Configures the given virtual server with the given default context path.voidsetDefaultHostName(String defaultHostName) Set default host.voidsetPort(int port) The Port this instance is used for mapping.
-
Field Details
-
hosts
Array containing the virtual hosts definitions. -
defaultHostName
Default host name. -
context
Context associated with this wrapper, used for wrapper mapping.
-
-
Constructor Details
-
Mapper
public Mapper()
-
-
Method Details
-
setAllowReplacement
public static void setAllowReplacement(boolean ar) Allow replacement of already addedMapper.Host,Mapper.ContextandMapper.Wrapperwhen invokingaddHost(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 false -
allowReplacement
public static boolean allowReplacement()true if replacement of already added [@link Host},Mapper.ContextandMapper.Wrapperwhen invokingaddHost(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 false -
setPort
public void setPort(int port) The Port this instance is used for mapping. -
getPort
public int getPort()- Returns:
- the port this instance is used for mapping.
-
getDefaultHostName
- Returns:
- Default host name
-
setDefaultHostName
Set default host.- Parameters:
defaultHostName- Default host name
-
addHost
Add a new host to the mapper.- Parameters:
name- Virtual host namehost- Host object
-
removeHost
Remove a host from the mapper.- Parameters:
name- Virtual host name
-
getHosts
-
setContext
Set context, used for wrapper mapping (request dispatcher).- Parameters:
welcomeResources- Welcome files defined for this contextresources- Static resources of the context
-
addContext
public void addContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources) Add a new Context to an existing Host.- Parameters:
hostName- Virtual host name this context belongs topath- Context pathcontext- Context objectwelcomeResources- Welcome files defined for this contextresources- Static resources of the context
-
addContext
public void addContext(String hostName, String path, Object context, String[] welcomeResources, NamingContext resources, List<AlternateDocBase> alternateDocBases) Add a new Context to an existing Host.- Parameters:
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 context
-
removeContext
Remove a context from an existing host.- Parameters:
hostName- Virtual host name this context belongs topath- Context path
-
getContextNames
Return all contexts, in //HOST/PATH form- Returns:
- The context names
-
addWrapper
Add a new Wrapper to an existing Context.- Parameters:
hostName- Virtual host name this wrapper belongs tocontextPath- Context path this wrapper belongs topath- Wrapper mappingwrapper- Wrapper object
-
addWrapper
public void addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard) Add a new Wrapper to an existing Context.- Parameters:
hostName- Virtual host name this wrapper belongs tocontextPath- Context path this wrapper belongs topath- Wrapper mappingwrapper- Wrapper objectjspWildCard- jsp wildcard
-
addWrapper
public void addWrapper(String hostName, String contextPath, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial) Add a new Wrapper to an existing Context.- Parameters:
hostName- Virtual host name this wrapper belongs tocontextPath- Context path this wrapper belongs topath- Wrapper mappingwrapper- Wrapper objectjspWildCard- jsp wildcardservletName- servlet name or null if unknown
-
addWrapper
Add a wrapper to the context associated with this wrapper.- Parameters:
path- Wrapper mappingwrapper- The Wrapper object
-
addWrapper
-
addWrapper
-
addWrapper
protected void addWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, boolean isEmptyPathSpecial) -
addWrapper
protected void addWrapper(Mapper.Context context, String path, Object wrapper, boolean jspWildCard, String servletName, boolean isEmptyPathSpecial) Adds a wrapper to the given context.- Parameters:
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 unknown
-
removeWrapper
Remove a wrapper from the context associated with this wrapper.- Parameters:
path- Wrapper mapping
-
removeWrapper
Remove a wrapper from an existing context.- Parameters:
hostName- Virtual host name this wrapper belongs tocontextPath- Context path this wrapper belongs topath- Wrapper mapping
-
removeWrapper
-
getWrappersString
-
getWrapperNames
-
setDefaultContextPath
Configures the given virtual server with the given default context path. The given default path corresponds to the context path of one of the web contexts deployed on the virtual server that has been designated as the virtual server's new default-web-module.- Throws:
Exception- if there is no web context deployed on the given virtual server that matches the given default context path
-
mapUriWithSemicolon
public void mapUriWithSemicolon(org.glassfish.grizzly.http.HttpRequestPacket requestPacket, org.glassfish.grizzly.http.util.DataChunk decodedURI, MappingData mappingData, int semicolonPos) throws Exception 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.- Parameters:
requestPacket- the request packet containing the host information to be used by the mapping process.decodedURI- decoded URImappingData-MappingDatabased 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.- Throws:
Exception- if an error occurs mapping the request
-
mapUriWithSemicolon
public void mapUriWithSemicolon(org.glassfish.grizzly.http.util.DataChunk serverName, org.glassfish.grizzly.http.util.DataChunk decodedURI, MappingData mappingData, int semicolonPos) throws Exception 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.- Parameters:
serverName- the server name as described by the Host header.decodedURI- decoded URImappingData-MappingDatabased 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.- Throws:
Exception- if an error occurs mapping the request
-
map
public void map(org.glassfish.grizzly.http.util.DataChunk host, org.glassfish.grizzly.http.util.DataChunk uri, MappingData mappingData) throws Exception Map the specified host name and URI, mutating the given mapping data.- Parameters:
host- Virtual host nameuri- URImappingData- This structure will contain the result of the mapping operation- Throws:
Exception
-
map
public void map(org.glassfish.grizzly.http.HttpRequestPacket requestPacket, org.glassfish.grizzly.http.util.DataChunk uri, MappingData mappingData) throws Exception Map the specified host name and URI, mutating the given mapping data.- Parameters:
requestPacket- the http request containing host name information used by the mapping process.uri- URImappingData- This structure will contain the result of the mapping operation- Throws:
Exception
-
map
public void map(org.glassfish.grizzly.http.util.MessageBytes uri, MappingData mappingData) throws Exception Map the specified URI relative to the context, mutating the given mapping data.- Parameters:
uri- URImappingData- This structure will contain the result of the mapping operation- Throws:
Exception
-