Package jakarta.servlet.annotation
Annotation Type WebFilter
The annotation used to declare a Servlet
This annotation will be processed by the container during deployment, the Filter class in which it is found will be created as per the configuration and applied to the URL patterns,
If the name attribute is not defined, the fully qualified name of the class is used.
At least one URL pattern MUST be declared in either the
The
The annotated class MUST implement
Filter
. This annotation will be processed by the container during deployment, the Filter class in which it is found will be created as per the configuration and applied to the URL patterns,
Servlet
s and
DispatcherType
s.If the name attribute is not defined, the fully qualified name of the class is used.
At least one URL pattern MUST be declared in either the
value
or urlPattern
attribute of the
annotation, but not both.The
value
attribute is recommended for use when the URL pattern is the only attribute being set, otherwise
the urlPattern
attribute should be used.The annotated class MUST implement
Filter
. E.g. @WebFilter("/path/*")
public class AnExampleFilter implements Filter { ...
- Since:
- Servlet 3.0 (Section 8.1.2)
-
Element Details
-
description
-
displayName
-
initParams
-
filterName
-
smallIcon
-
largeIcon
-
servletNames
-
value
String[] valueA convenience method, to allow extremely simple annotation of a class.- Returns:
- array of URL patterns
- See Also:
- Default:
{}
-
urlPatterns
-
dispatcherTypes
DispatcherType[] dispatcherTypes- Returns:
- array of DispatcherTypes to which this filter applies
- Default:
{REQUEST}
-
asyncSupported
boolean asyncSupported- Returns:
- asynchronous operation supported by this Filter
- Default:
false
-