Servlet 3.0 - Apache Tomcat 7.0.28

javax.servlet.annotation
Annotation Type WebFilter


@Target(value=TYPE)
@Retention(value=RUNTIME)
@Documented
public @interface WebFilter

The annotation used to declare a Servlet 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, 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 { ...

Since:
Servlet 3.0 (Section 8.1.2)

Optional Element Summary
 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.
 

description

public abstract java.lang.String description
Returns:
description of the Filter, if present
Default:
""

displayName

public abstract java.lang.String displayName
Returns:
display name of the Filter, if present
Default:
""

initParams

public abstract WebInitParam[] initParams
Returns:
array of initialization params for this Filter
Default:
{}

filterName

public abstract java.lang.String filterName
Returns:
name of the Filter, if present
Default:
""

smallIcon

public abstract java.lang.String smallIcon
Returns:
small icon for this Filter, if present
Default:
""

largeIcon

public abstract java.lang.String largeIcon
Returns:
the large icon for this Filter, if present
Default:
""

servletNames

public abstract java.lang.String[] servletNames
Returns:
array of Servlet names to which this Filter applies
Default:
{}

value

public abstract java.lang.String[] value
A convenience method, to allow extremely simple annotation of a class.

Returns:
array of URL patterns
See Also:
urlPatterns()
Default:
{}

urlPatterns

public abstract java.lang.String[] urlPatterns
Returns:
array of URL patterns to which this Filter applies
Default:
{}

dispatcherTypes

public abstract DispatcherType[] dispatcherTypes
Returns:
array of DispatcherTypes to which this filter applies
Default:
javax.servlet.DispatcherType.REQUEST

asyncSupported

public abstract boolean asyncSupported
Returns:
asynchronous operation supported by this Filter
Default:
false

Servlet 3.0 - Apache Tomcat 7.0.28

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.