javax.portlet.filter

## Interface PortletFilter

All Known Subinterfaces:
  ActionFilter, EventFilter, RenderFilter, ResourceFilter

    public interface PortletFilter

The `PortletFilter` is the base interface for all portlet filters. It provides the lifecycle methods `init` and `destroy` for putting a portlet filter into and out of service.

Since:
  2.0

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `destroy()` Called by the portlet container to indicate to a filter that it is being taken out of service.
`void` `init(FilterConfig filterConfig)` Called by the portlet container to indicate to a filter that it is being placed into service.

### Method Detail

#### init

    void init(FilterConfig filterConfig)
       throws PortletException

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

- throws a PortletException
- does not return within a time period defined by the portlet container

Parameters:
  `filterConfig` - the filter configuration data defined in the portlet deployment descriptor
Throws:
  `PortletException` - if an error occurs in the filter initialization

#### destroy

    void destroy()

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.