Portlet Filter

##### Project Documentation

- About Portlet Filter
- Project Info
- Project Reports
- Development Process

## About Apache Portals Portlet Filter

### Overview

FilterPortlet enables you to add processes you want before and after accessing the target portlet. The feature provided by FilterPortlet is like Servlet Filter. (Portlet Filter may be included in the future Portlet Spec, but currently it's not included yet.)

### Class and Interface

Class/Interface | Description
--- | ---
FilterPortlet class | FilterPortlet wraps the target portlet.
PortletFilter interface | The process you want to add is implemented this interface.
PortletFilterChain class | This class is an object provided to the developer giving a view into the invocation chain of a filtered request for a resource.
PortletFilterConfig class | A filter configuration object used by FilterPortlet to pass information to a filter during initialization.

If you know how to use Servlet Filter, it's easy to use FilterPortlet.

### Example

For example, if you create "HelloWorldPortletFilter" as the portlet filter, portlet.xml is:

    <portlet-app id="helloworld" version="1.0">
      <portlet id="FilteredHelloWorld">
        <portlet-name>FilteredHelloWorld</portlet-name>
        <display-name>Filtered Hello World</display-name>
        <description>HelloWorld is a filtered portlet for testing</description>
        <portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class>
        <init-param>
          <name>portlet-class</name>
          <value>org.apache.portals.bridges.helloworld.HelloWorldPortlet</value>
        </init-param>
        <init-param>
          <name>portlet-filters</name>
          <value>org.apache.portals.bridges.helloworld.filter.HelloWorldPortletFilter</value>
        </init-param>
        <expiration-cache>-1</expiration-cache>
        <supports>
          <mime-type>text/html</mime-type>
          <portlet-mode>VIEW</portlet-mode>
        </supports>
        <supported-locale>en</supported-locale>
        <supported-locale>ja</supported-locale>
        <resource-bundle>org.apache.portals.bridges.helloworld.resources.HelloWorldResources</resource-bundle>
        <portlet-info>
          <title>Filtered Hello World</title>
          <short-title>This is a filtered portlet for testing</short-title>
          <keywords>Hello,Test,PortletFilter</keywords>
        </portlet-info>
      </portlet>
    </portlet-app>