Module cloud.piranha.core.impl
Package cloud.piranha.core.impl
Class DefaultWebApplicationRequestMapper
java.lang.Object
cloud.piranha.core.impl.DefaultWebApplicationRequestMapper
- All Implemented Interfaces:
WebApplicationRequestMapper
public class DefaultWebApplicationRequestMapper
extends Object
implements WebApplicationRequestMapper
The default WebApplicationRequestMapper.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
Stores the default servletprotected final List<FilterMapping>
Stores the filter mappings.protected final ConcurrentHashMap<String,
String> Stores the servlet mappings. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFilterMapping
(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, String... urlPatterns) Add a filter mapping.addFilterMappingBeforeExisting
(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, String... urlPatterns) Add a filter mapping.addServletMapping
(String servletName, String... urlPatterns) Add a servlet mapping.findFilterMappings
(jakarta.servlet.DispatcherType dispatcherType, String path) Find the filter mappings.findServletMapping
(String path) Find a servlet mapping for the given path.Get the default servlet.getServletMappings
(String servletName) Get the mappings for the specified servlet.getServletName
(String mapping) Get the servlet name for the specified mapping..removeServletMapping
(String urlPattern) Remove a mapping.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cloud.piranha.core.api.WebApplicationRequestMapper
addFilterMapping, addFilterMappingBeforeExisting, findFilterMappings
-
Field Details
-
filterMappings
Stores the filter mappings. -
servletMappings
Stores the servlet mappings. -
defaultServlet
Stores the default servlet
-
-
Constructor Details
-
DefaultWebApplicationRequestMapper
public DefaultWebApplicationRequestMapper()
-
-
Method Details
-
addFilterMapping
public Set<String> addFilterMapping(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, String... urlPatterns) Description copied from interface:WebApplicationRequestMapper
Add a filter mapping.This adds the filter mappings at the end of list of existing mappings (if any).
- Specified by:
addFilterMapping
in interfaceWebApplicationRequestMapper
- Parameters:
dispatcherTypes
- the dispatcher types.filterName
- the filter name.urlPatterns
- the URL patterns to map (aka mappings).- Returns:
- the URL patterns that were added.
-
addFilterMappingBeforeExisting
public Set<String> addFilterMappingBeforeExisting(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, String... urlPatterns) Description copied from interface:WebApplicationRequestMapper
Add a filter mapping.This adds the filter mappings at the start of list of existing mappings (if any). If there are existing mappings these are shifted to the right.
- Specified by:
addFilterMappingBeforeExisting
in interfaceWebApplicationRequestMapper
- Parameters:
dispatcherTypes
- the dispatcher types.filterName
- the filter name.urlPatterns
- the URL patterns to map (aka mappings).- Returns:
- the URL patterns that were added.
-
addServletMapping
Add a servlet mapping.This method will throw an IllegalArgumentException if a URL pattern is null or empty (Servlet:JAVADOC:696.3).
This method accommodates for a URL pattern that does not start with a leading slash to support pre-Servlet 2.3 application to operate properly.
- Specified by:
addServletMapping
in interfaceWebApplicationRequestMapper
- Parameters:
servletName
- the servlet name.urlPatterns
- the URL patterns to map (aka mappings).- Returns:
- the URL patterns that were already added.
-
removeServletMapping
Description copied from interface:WebApplicationRequestMapper
Remove a mapping.- Specified by:
removeServletMapping
in interfaceWebApplicationRequestMapper
- Parameters:
urlPattern
- the URL pattern- Returns:
- the Servlet name the pattern was mapped to, or null if no prior mapping.
-
findFilterMappings
public Collection<String> findFilterMappings(jakarta.servlet.DispatcherType dispatcherType, String path) Find the filter mappings.- Specified by:
findFilterMappings
in interfaceWebApplicationRequestMapper
- Parameters:
path
- the path.dispatcherType
- the dispatcher type.- Returns:
- the filter mappings.
-
findServletMapping
Find a servlet mapping for the given path.- Specified by:
findServletMapping
in interfaceWebApplicationRequestMapper
- Parameters:
path
- the path.- Returns:
- the mapping, or null if not found.
-
getServletMappings
Get the mappings for the specified servlet.- Specified by:
getServletMappings
in interfaceWebApplicationRequestMapper
- Parameters:
servletName
- the servlet name.- Returns:
- the mappings, or an empty collection if none.
-
getServletName
Get the servlet name for the specified mapping..- Specified by:
getServletName
in interfaceWebApplicationRequestMapper
- Parameters:
mapping
- the mapping.- Returns:
- the servlet name, or null if not found.
-
getDefaultServlet
Description copied from interface:WebApplicationRequestMapper
Get the default servlet.- Specified by:
getDefaultServlet
in interfaceWebApplicationRequestMapper
- Returns:
- the default servlet.
-