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 Details

    • filterMappings

      protected final List<FilterMapping> filterMappings
      Stores the filter mappings.
    • servletMappings

      protected final ConcurrentHashMap<String,String> servletMappings
      Stores the servlet mappings.
    • defaultServlet

      protected String 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 interface WebApplicationRequestMapper
      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 interface WebApplicationRequestMapper
      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

      public Set<String> addServletMapping(String servletName, String... urlPatterns)
      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 interface WebApplicationRequestMapper
      Parameters:
      servletName - the servlet name.
      urlPatterns - the URL patterns to map (aka mappings).
      Returns:
      the URL patterns that were already added.
    • removeServletMapping

      public String removeServletMapping(String urlPattern)
      Description copied from interface: WebApplicationRequestMapper
      Remove a mapping.
      Specified by:
      removeServletMapping in interface WebApplicationRequestMapper
      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 interface WebApplicationRequestMapper
      Parameters:
      path - the path.
      dispatcherType - the dispatcher type.
      Returns:
      the filter mappings.
    • findServletMapping

      public DefaultWebApplicationRequestMapping findServletMapping(String path)
      Find a servlet mapping for the given path.
      Specified by:
      findServletMapping in interface WebApplicationRequestMapper
      Parameters:
      path - the path.
      Returns:
      the mapping, or null if not found.
    • getServletMappings

      public Collection<String> getServletMappings(String servletName)
      Get the mappings for the specified servlet.
      Specified by:
      getServletMappings in interface WebApplicationRequestMapper
      Parameters:
      servletName - the servlet name.
      Returns:
      the mappings, or an empty collection if none.
    • getServletName

      public String getServletName(String mapping)
      Get the servlet name for the specified mapping..
      Specified by:
      getServletName in interface WebApplicationRequestMapper
      Parameters:
      mapping - the mapping.
      Returns:
      the servlet name, or null if not found.
    • getDefaultServlet

      public String getDefaultServlet()
      Description copied from interface: WebApplicationRequestMapper
      Get the default servlet.
      Specified by:
      getDefaultServlet in interface WebApplicationRequestMapper
      Returns:
      the default servlet.