Class FilterMap

  • All Implemented Interfaces:
    java.io.Serializable

    public class FilterMap
    extends XmlEncodingBase
    implements java.io.Serializable
    Representation of a filter mapping for a web application, as represented in a <filter-mapping> element in the deployment descriptor. Each filter mapping must contain a filter name plus either a URL pattern or a servlet name.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ASYNC
      Dispatcher type constant for async dispatch.
      static int ERROR
      Dispatcher type constant for error dispatch.
      static int FORWARD
      Dispatcher type constant for forward dispatch.
      static int INCLUDE
      Dispatcher type constant for include dispatch.
      static int REQUEST
      Dispatcher type constant for request dispatch.
    • Constructor Summary

      Constructors 
      Constructor Description
      FilterMap()
      Default constructor for FilterMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addServletName​(java.lang.String servletName)
      Adds a servlet name to the set of servlet names this mapping matches.
      void addURLPattern​(java.lang.String urlPattern)
      Adds a URL pattern to the set of URL patterns this mapping matches.
      void addURLPatternDecoded​(java.lang.String urlPattern)
      Adds a decoded URL pattern to the set of URL patterns this mapping matches.
      int getDispatcherMapping()
      Returns the dispatcher mapping bitmask for this filter mapping.
      java.lang.String[] getDispatcherNames()
      Returns the names of the dispatchers mapped to this filter.
      java.lang.String getFilterName()
      Returns the name of the filter associated with this mapping.
      boolean getMatchAllServletNames()
      Returns whether this mapping matches all servlet names.
      boolean getMatchAllUrlPatterns()
      Returns whether this mapping matches all URL patterns.
      java.lang.String[] getServletNames()
      Returns the servlet names this mapping matches.
      java.lang.String[] getURLPatterns()
      Returns the URL patterns this mapping matches.
      void setDispatcher​(java.lang.String dispatcherString)
      This method will be used to set the current state of the FilterMap representing the state of when filters should be applied.
      void setFilterName​(java.lang.String filterName)
      Sets the name of the filter associated with this mapping.
      java.lang.String toString()
      Render a String representation of this object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ERROR

        public static final int ERROR
        Dispatcher type constant for error dispatch.
        See Also:
        Constant Field Values
      • FORWARD

        public static final int FORWARD
        Dispatcher type constant for forward dispatch.
        See Also:
        Constant Field Values
      • INCLUDE

        public static final int INCLUDE
        Dispatcher type constant for include dispatch.
        See Also:
        Constant Field Values
      • REQUEST

        public static final int REQUEST
        Dispatcher type constant for request dispatch.
        See Also:
        Constant Field Values
      • ASYNC

        public static final int ASYNC
        Dispatcher type constant for async dispatch.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FilterMap

        public FilterMap()
        Default constructor for FilterMap.
    • Method Detail

      • getFilterName

        public java.lang.String getFilterName()
        Returns the name of the filter associated with this mapping.
        Returns:
        The filter name
      • setFilterName

        public void setFilterName​(java.lang.String filterName)
        Sets the name of the filter associated with this mapping.
        Parameters:
        filterName - The filter name
      • getServletNames

        public java.lang.String[] getServletNames()
        Returns the servlet names this mapping matches.
        Returns:
        The servlet names, or an empty array if all servlet names match
      • addServletName

        public void addServletName​(java.lang.String servletName)
        Adds a servlet name to the set of servlet names this mapping matches.
        Parameters:
        servletName - The servlet name to add
      • getMatchAllUrlPatterns

        public boolean getMatchAllUrlPatterns()
        Returns whether this mapping matches all URL patterns.
        Returns:
        True if all URL patterns match
      • getMatchAllServletNames

        public boolean getMatchAllServletNames()
        Returns whether this mapping matches all servlet names.
        Returns:
        True if all servlet names match
      • getURLPatterns

        public java.lang.String[] getURLPatterns()
        Returns the URL patterns this mapping matches.
        Returns:
        The URL patterns, or an empty array if all URL patterns match
      • addURLPattern

        public void addURLPattern​(java.lang.String urlPattern)
        Adds a URL pattern to the set of URL patterns this mapping matches.
        Parameters:
        urlPattern - The URL pattern to add
      • addURLPatternDecoded

        public void addURLPatternDecoded​(java.lang.String urlPattern)
        Adds a decoded URL pattern to the set of URL patterns this mapping matches.
        Parameters:
        urlPattern - The decoded URL pattern to add
      • setDispatcher

        public void setDispatcher​(java.lang.String dispatcherString)
        This method will be used to set the current state of the FilterMap representing the state of when filters should be applied.
        Parameters:
        dispatcherString - the dispatcher type which should match this filter
      • getDispatcherMapping

        public int getDispatcherMapping()
        Returns the dispatcher mapping bitmask for this filter mapping.
        Returns:
        The dispatcher mapping bitmask, defaulting to REQUEST if not set
      • getDispatcherNames

        public java.lang.String[] getDispatcherNames()
        Returns the names of the dispatchers mapped to this filter.
        Returns:
        Array of dispatcher type names
      • toString

        public java.lang.String toString()
        Render a String representation of this object.
        Overrides:
        toString in class java.lang.Object