Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  SERVLET::FILTER (3)

.ds Aq ’


Servlet::Filter - filter interface




  # later

  $filter->doFilter($request, $response, $chain);

  my $config = $filter->getConfig();


This is the interface for an object that performs filtering tasks on the request for a resource, the response, or both.

Filters perform filtering in the doFilter() method. Every filter has access to a <B>Servlet::FilterConfigB> object from which it can obtain its initialization parameters and a reference to the <B>Servlet::ServletContextB> which it can use, for example, to load resources needed for filtering tasks.

Filters are configured in the deployment descriptor of a web application.

Examples that have been identified for this design are:
Authentication Filters
Logging and Auditing Filters
Image conversion Filters
Data compression Filters
Encryption Filters
Tokenizing Filters
Filters that trigger resource access events
XSL/T Filters
MIME-type chain Filters


doFilter($request, $response, $chain) This method is called by the container each time a request/response pair is passed through the filter chain due to a client request for a resource at the end of the chain. The filter chain passed into this method allows the filter to passon the request and response to the next entity in the chain.

A typical implementation of this method would follow such a pattern:
1. Examine the request
2. Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
3. Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
4. 4 a)

<B>EitherB> invoke the next entity in the chain by calling doFilter() on $chain,

5. 4 b)

<B>orB> block further filter processing by not passing the request/response pair down the chain

6. Directly set headers on the response after invocation of the next entity in the filter chain.

$request the <B>Servlet::ServletRequestB> object that contains the client’s request
$response the <B>Servlet::ServletResponseB> object that contains the servlet’s response
$chain the <B>Servlet::FilterChainB> through which the request and response are passed

<B>Servlet::ServletExceptionB> if an exception occurs while performing the filtering task

getFilterConfig() Returns the <B>Servlet::FilterConfigB> object for this filter
setFilterConfig($config) Set the config object for this filter

$config the <B>Servlet::FilterConfigB> object for this filter


Servlet::FilterChain, Servlet::FilterConfig, Servlet::ServletException, Servlet::ServletRequest, Servlet::ServletResponse


Brian Moseley,


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 92: Expected ’=item 4’
Around line 97: Expected ’=item 5’
Around line 102: You have ’=item 5’ instead of the expected ’=item 6’
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 SERVLET::FILTER (3) 2001-07-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.