Package jakarta.servlet.annotation
Annotation Type WebFilter
-
@Target(TYPE) @Retention(RUNTIME) @Documented public @interface WebFilter
The annotation used to declare a ServletFilter
.
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 andDispatcherType
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 thevalue
orurlPattern
attribute of the annotation, but not both.
Thevalue
attribute is recommended for use when the URL pattern is the only attribute being set, otherwise theurlPattern
attribute should be used.
The annotated class MUST implementFilter
. E.g.@WebFilter("/path/*")
public class AnExampleFilter implements Filter { ...
- Since:
- Servlet 3.0 (Section 8.1.2)
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
asyncSupported
java.lang.String
description
DispatcherType[]
dispatcherTypes
java.lang.String
displayName
java.lang.String
filterName
WebInitParam[]
initParams
java.lang.String
largeIcon
java.lang.String[]
servletNames
java.lang.String
smallIcon
java.lang.String[]
urlPatterns
java.lang.String[]
value
A convenience method, to allow extremely simple annotation of a class.
-
-
-
-
initParams
WebInitParam[] initParams
- Returns:
- array of initialization params for this Filter
- Default:
- {}
-
-
-
value
java.lang.String[] value
A convenience method, to allow extremely simple annotation of a class.- Returns:
- array of URL patterns
- See Also:
urlPatterns()
- Default:
- {}
-
-
-
dispatcherTypes
DispatcherType[] dispatcherTypes
- Returns:
- array of DispatcherTypes to which this filter applies
- Default:
- {jakarta.servlet.DispatcherType.REQUEST}
-
-