com.ibm.wps.pe.pc.legacy.cmpf
Interface PortletFilter

All Known Implementing Classes:
PortletFilterAdapter

Deprecated. since 6.0. Support of the IBM portlet API may be removed in a future release of WebSphere Portal. Use of the Java Portlet API (javax.portlet) is recommended instead.

public interface PortletFilter

A portlet filter is an object that performs filtering on the request to a portlet, or on the 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 PortalContext which it can use, for example, to load resources needed for filtering tasks.

Portlet filters are filters of the portlet container that may be applied to all available portlets in the portal to filter each portlet's request/response. The lifecycle of a portlet filter is identical to the portal server's lifecycle.

Filters are configured in the PortletFilter.properties file of the portal.
Examples that have been identified for this design are

  1. Translation Filters
  2. Transcoding Filters
  3. Logging and Auditing Filters
  4. Image conversion Filters
  5. Data compression Filters
  6. Encryption Filters

Since:
5.0
Note:
This interface is designed to be implemented by clients.

Nested Class Summary
static class PortletFilter.Method
          Deprecated. The Method class is a finite enumeration of the possible methods that a filter can invoke.
 
Method Summary
 void destroy()
          Deprecated. Called by the portlet container to indicate to a filter that it is being taken out of service.
 void doFilter(PortletFilter.Method method, org.apache.jetspeed.portlet.PortletRequest request, org.apache.jetspeed.portlet.PortletResponse response, PortletFilterChain chain)
          Deprecated. The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.
 void init(PortletFilterConfig filterConfig)
          Deprecated. Called by the portlet container to indicate to a filter that it is being placed into service.
 

Method Detail

init

void init(PortletFilterConfig filterConfig)
          throws org.apache.jetspeed.portlet.PortletException
Deprecated. 
Called by the portlet container to indicate to a filter that it is being placed into service. The portlet container calls the init method exactly once after instantiating the filter.
The init method must complete successfully before the filter is asked to do any filtering work.

The portlet container cannot place the filter into service if the init method either

  1. Throws a PortletException
  2. Does not return within a time period defined by the portlet container

Parameters:
filterConfig - the portlet filter config
Throws:
org.apache.jetspeed.portlet.PortletException - if an exception has occurrred that interferes with the portlet filter's normal initialization

doFilter

void doFilter(PortletFilter.Method method,
              org.apache.jetspeed.portlet.PortletRequest request,
              org.apache.jetspeed.portlet.PortletResponse response,
              PortletFilterChain chain)
              throws org.apache.jetspeed.portlet.PortletException,
                     java.io.IOException
Deprecated. 
The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.

Please note that the response may be null for an event-based method, e.g., ActionEvent.

The FilterChain passed in to this method allows the Filter to pass on the request and response to the next filter in the chain.

A typical implementation of this method would follow the following 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. Invoke the next filter in the chain using the FilterChain object (chain.doFilter())

Parameters:
method - the type of requested method
request - the request to pass along the chain.
response - the response to pass along the chain.
chain - the portlet filter chain
Throws:
org.apache.jetspeed.portlet.PortletException - if the filter has trouble fulfilling the request
java.io.IOException - if the streaming causes an I/O problem
See Also:
PortletFilterChain

destroy

void destroy()
Deprecated. 
Called by the portlet container to indicate to a filter that it is being taken out of service. This method is only called once. All threads within the filter's doFilter method have exited or after a timeout period has passed. After the portlet container calls this method, it will not call the doFilter method again on this instance of the filter.
This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.