Defines a generic, protocol-independent
filter. To write an HTTP filter for use on the
Web, extend javax.servlet.http.HttpFilter instead.
GenericFilter implements the Filter
and FilterConfig interfaces. GenericFilter
may be directly extended by a filter, although it's more common to extend
a protocol-specific subclass such as HttpFilter.
GenericFilter makes writing filters
easier. It provides simple versions of the lifecycle methods
init and destroy and of the methods
in the FilterConfig interface.
To write a generic filter, you need only
override the abstract doFilter method.
| Modifier and Type | Field and Description |
|---|---|
| private transient FilterConfig | |
| private static final String | |
| private static final ResourceBundle |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FilterConfig | Returns: FilterConfig theFilterConfig object
that initialized this filterReturns this servlet's |
| public String | Returns: the name of this filter instanceImplements javax. Returns the name of this filter instance. |
| public String | Returns: String aString containing the value
of the initialization parametera name)String specifying the name
of the initialization parameterImplements javax. Returns a |
| public Enumeration | Returns: Enumeration an enumeration ofString
objects containing the names of
the filter's initialization parametersImplements javax. Returns the names of the filter's initialization parameters
as an |
| public ServletContext | Returns: ServletContext theServletContext object
passed to this filter by the init
methodImplements javax. Returns a reference to the |
| public void | init(FilterConfig
the config)FilterConfig object
that contains configuration
information for this filterOverrides default javax. Called by the servlet container to indicate to a filter that it is being placed into service. |
| public void | init()
A convenience method which can be overridden so that there's no need
to call |
| config | back to summary |
|---|---|
| private transient FilterConfig config | |
| LSTRING_FILE | back to summary |
|---|---|
| private static final String LSTRING_FILE | |
| lStrings | back to summary |
|---|---|
| private static final ResourceBundle lStrings | |
| GenericFilter | back to summary |
|---|---|
| public GenericFilter() Does nothing. All of the filter initialization
is done by one of the
| |
| getFilterConfig | back to summary |
|---|---|
| public FilterConfig getFilterConfig() Returns this servlet's
| |
| getFilterName | back to summary |
|---|---|
| public String getFilterName() Implements javax. Returns the name of this filter instance.
See | |
| getInitParameter | back to summary |
|---|---|
| public String getInitParameter(String name) Implements javax. Returns a This method is supplied for convenience. It gets the
value of the named parameter from the servlet's
| |
| getInitParameterNames | back to summary |
|---|---|
| public Enumeration Implements javax. Returns the names of the filter's initialization parameters
as an This method is supplied for convenience. It gets the
parameter names from the filter's
| |
| getServletContext | back to summary |
|---|---|
| public ServletContext getServletContext() Implements javax. Returns a reference to the This method is supplied for convenience. It gets the
context from the filter's
| |
| init | back to summary |
|---|---|
| public void init(FilterConfig config) throws ServletException Overrides default javax. Called by the servlet container to indicate to a filter that
it is being placed into service. See This implementation stores the
| |
| init | back to summary |
|---|---|
| public void init() throws ServletException A convenience method which can be overridden so that there's no need
to call Instead of overriding
| |