ResourceFilter is an object that performs filtering
tasks on either the resource request to a portlet, or on the resource response from
a portlet, or both.
Filters perform filtering in the doFilter method. Every Filter has
access to a FilterConfig object from which it can obtain
its initialization parameters, a reference to the PortletContext
which it can use, for example, to load resources needed for filtering tasks.
Filters are configured in the portlet deployment descriptor of a portlet application.
If the ResourceFilter is to support asynchronous mode, care must be taken
regarding resource allocation and release.
Any resources attached to the ResourceRequest during the inbound portion
of the doFilter invocation
and needed during asynchronous processing should not be released during outbound processing
if asynchronous mode has been started.
If resources must be allocated in this way during inbound processing, the portlet should
use a javax.portlet.PortletAsyncListener to release the resources upon request
completion even when error conditions or timeouts occur.
Alternatively, the portlet may
use the AsyncContext#dispatch() method at the end of asynchronous processing
in order to cause the portlet resource method to be invoked again with the same
ResourceRequest and ResourceResponse objects.
The resources can be released during asynchronous dispatch outbound processing if
asynchronous mode is not active.
The ResourceRequest#isAsyncStarted() method will return true
if the portlet is currently in asynchronous mode.
The ResourceRequest#igetDispatcherType() method will return
DispatcherType#REQUEST during initial request processing and
DipatcherType#ASYNC during processing resulting from an asynchronous dispatch.
| Modifier and Type | Method and Description |
|---|---|
| public void | doFilter(ResourceRequest
the current resource request request, ResourceResponse the current resource response response, FilterChain the remaining filter chain chain)The |
| doFilter | back to summary |
|---|---|
| public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException, PortletException The
The
The
| |