Defines a generic, protocol-independent filter. To write an HTTP filter for use on the Web, extend
jakarta. 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 | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FilterConfig | Returns: FilterConfig theFilterConfig object that initialized this filter
Returns this servlet's |
| public String | Returns: the name of this filter instanceImplements jakarta. 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 jakarta.
Returns a |
| public Enumeration | Returns: Enumeration an enumeration ofString objects containing the names of the filter's initialization
parametersImplements jakarta.
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 jakarta.
Returns a reference to the |
| public void | init(FilterConfig
the config)FilterConfig object that contains configuration information for this filterOverrides default jakarta. 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 | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| 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 jakarta.
Returns the name of this filter instance. See | |
| getInitParameter | back to summary |
|---|---|
| public String getInitParameter(String name) Implements jakarta.
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 jakarta.
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 jakarta.
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 jakarta.
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
| |