Class FilterMap
java.lang.Object
org.apache.tomcat.util.descriptor.web.XmlEncodingBase
org.apache.tomcat.util.descriptor.web.FilterMap
- All Implemented Interfaces:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDispatcher type constant for async dispatch.static final intDispatcher type constant for error dispatch.static final intDispatcher type constant for forward dispatch.static final intDispatcher type constant for include dispatch.static final intDispatcher type constant for request dispatch. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddServletName(String servletName) Adds a servlet name to the set of servlet names this mapping matches.voidaddURLPattern(String urlPattern) Adds a URL pattern to the set of URL patterns this mapping matches.voidaddURLPatternDecoded(String urlPattern) Adds a decoded URL pattern to the set of URL patterns this mapping matches.intReturns the dispatcher mapping bitmask for this filter mapping.String[]Returns the names of the dispatchers mapped to this filter.Returns the name of the filter associated with this mapping.booleanReturns whether this mapping matches all servlet names.booleanReturns whether this mapping matches all URL patterns.String[]Returns the servlet names this mapping matches.String[]Returns the URL patterns this mapping matches.voidsetDispatcher(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(String filterName) Sets the name of the filter associated with this mapping.toString()Render a String representation of this object.Methods inherited from class XmlEncodingBase
getCharset, setCharset
-
Field Details
-
ERROR
public static final int ERRORDispatcher type constant for error dispatch.- See Also:
-
FORWARD
public static final int FORWARDDispatcher type constant for forward dispatch.- See Also:
-
INCLUDE
public static final int INCLUDEDispatcher type constant for include dispatch.- See Also:
-
REQUEST
public static final int REQUESTDispatcher type constant for request dispatch.- See Also:
-
ASYNC
public static final int ASYNCDispatcher type constant for async dispatch.- See Also:
-
-
Constructor Details
-
FilterMap
public FilterMap()Default constructor for FilterMap.
-
-
Method Details
-
getFilterName
Returns the name of the filter associated with this mapping.- Returns:
- The filter name
-
setFilterName
Sets the name of the filter associated with this mapping.- Parameters:
filterName- The filter name
-
getServletNames
Returns the servlet names this mapping matches.- Returns:
- The servlet names, or an empty array if all servlet names match
-
addServletName
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
Returns the URL patterns this mapping matches.- Returns:
- The URL patterns, or an empty array if all URL patterns match
-
addURLPattern
Adds a URL pattern to the set of URL patterns this mapping matches.- Parameters:
urlPattern- The URL pattern to add
-
addURLPatternDecoded
Adds a decoded URL pattern to the set of URL patterns this mapping matches.- Parameters:
urlPattern- The decoded URL pattern to add
-
setDispatcher
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
Returns the names of the dispatchers mapped to this filter.- Returns:
- Array of dispatcher type names
-
toString
-