Servlet::Filter - filter interface
$filter->setFilterConfig($fconfig); # 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 Servlet::FilterConfig object from which it can obtain its initialization parameters and a reference to the Servlet::ServletContext which it can use, for example, to load resources needed for filtering tasks.
doFilter()
Filters are configured in the deployment descriptor of a web application.
Examples that have been identified for this design are:
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:
Examine the request
Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
4 a)
Either invoke the next entity in the chain by calling doFilter() on $chain,
4 b)
or block further filter processing by not passing the request/response pair down the chain
Directly set headers on the response after invocation of the next entity in the filter chain.
Parameters:
the Servlet::ServletRequest object that contains the client's request
the Servlet::ServletResponse object that contains the servlet's response
the Servlet::FilterChain through which the request and response are passed
Throws:
if an exception occurs while performing the filtering task
Returns the Servlet::FilterConfig object for this filter
Set the config object for this filter
the Servlet::FilterConfig object for this filter
Servlet::FilterChain, Servlet::FilterConfig, Servlet::ServletException, Servlet::ServletRequest, Servlet::ServletResponse
Brian Moseley, bcm@maz.org
3 POD Errors
The following errors were encountered while parsing the POD:
Expected '=item 4'
Expected '=item 5'
You have '=item 5' instead of the expected '=item 6'
To install Servlet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Servlet
CPAN shell
perl -MCPAN -e shell install Servlet
For more information on module installation, please visit the detailed CPAN module installation guide.