|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME) @Target(value=TYPE) public @interface WebFilter
The annotation used to declare a Servlet Filter.
This feature is only supported for Servlet API 3.0 and onwards.
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, Servlets and
DispatcherTypes.
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 { ...
<beanlet type="com.acme.servlet.TestFilter">
<web:filter filter-name="testFilter" create-filter="true">
<!--web:url-pattern value="/test/TestServlet"/-->
<web:init-param key="test-user" value="john"/>
<web:servlet-name value="TestServlet"/>
</web:filter>
</beanlet>
<beanlet type="com.acme.servlet.TestFilter">
<web:filter filter-name="testFilter">
<!--<web:url-patterns>-->
<!--<web:url-pattern value="/test/TestServlet"/>-->
<!--<web:url-pattern value="/test/ProductionServlet"/>-->
<!--</web:url-patterns>-->
<web:init-params>
<web:init-param key="test-user" value="john"/>
<web:init-param key="production-user" value="john"/>
</web:init-params>
<web:servlet-names>
<web:servlet-name value="TestServlet"/>
<web:servlet-name value="ProductionServlet"/>
</web:servlet-names>
</web:filter>
</beanlet>
| Optional Element Summary | |
|---|---|
boolean |
asyncSupported
|
boolean |
createFilter
|
String |
description
|
javax.servlet.DispatcherType[] |
dispatcherTypes
|
String |
displayName
|
String |
filterName
|
javax.servlet.annotation.WebInitParam[] |
initParams
|
String |
largeIcon
|
String[] |
servletNames
|
String |
smallIcon
|
String[] |
urlPatterns
|
String[] |
value
A convenience method, to allow extremely simple annotation of a class. |
public abstract boolean createFilter
true if instance is created by Servlet container.public abstract String description
public abstract String displayName
public abstract javax.servlet.annotation.WebInitParam[] initParams
public abstract String filterName
public abstract String smallIcon
public abstract String largeIcon
public abstract String[] servletNames
public abstract String[] value
urlPatterns()public abstract String[] urlPatterns
public abstract javax.servlet.DispatcherType[] dispatcherTypes
public abstract boolean asyncSupported
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||