Class FilterMap
- java.lang.Object
-
- org.apache.tomcat.util.descriptor.web.XmlEncodingBase
-
- org.apache.tomcat.util.descriptor.web.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 intASYNCDispatcher type constant for async dispatch.static intERRORDispatcher type constant for error dispatch.static intFORWARDDispatcher type constant for forward dispatch.static intINCLUDEDispatcher type constant for include dispatch.static intREQUESTDispatcher 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 voidaddServletName(java.lang.String servletName)Adds a servlet name to the set of servlet names this mapping matches.voidaddURLPattern(java.lang.String urlPattern)Adds a URL pattern to the set of URL patterns this mapping matches.voidaddURLPatternDecoded(java.lang.String urlPattern)Adds a decoded URL pattern to the set of URL patterns this mapping matches.intgetDispatcherMapping()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.StringgetFilterName()Returns the name of the filter associated with this mapping.booleangetMatchAllServletNames()Returns whether this mapping matches all servlet names.booleangetMatchAllUrlPatterns()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.voidsetDispatcher(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.voidsetFilterName(java.lang.String filterName)Sets the name of the filter associated with this mapping.java.lang.StringtoString()Render a String representation of this object.-
Methods inherited from class org.apache.tomcat.util.descriptor.web.XmlEncodingBase
getCharset, setCharset
-
-
-
-
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
-
-
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:
toStringin classjava.lang.Object
-
-