Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.filter
Class CompositeFilter

    java.lang.Object
      org.springframework.web.filter.CompositeFilter

All Implemented Interfaces:
  javax.servlet.Filter

    public class CompositeFilter

extends java.lang.Object
implements javax.servlet.Filter

A generic composite servlet `Filter` that just delegates its behaviour to a chain (list) of user supplied filters, achieving the functionality of a `FilterChain`, but conveniently using only `Filter` instances. This is useful for filters that require dependency injection, and can therefore be set up in a Spring application context. Typically this composite would be used in conjunction with `DelegatingFilterProxy`, so that it can be declared in Spring but applied to a servlet context.

Since:
  3.1
Author:
  Dave Syer

Constructor Summary
`CompositeFilter()`

Method Summary
`void` | `destroy()` Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.
`void` | `doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)` Forms a temporary chain from the list of delegate filters supplied (`setFilters(List)`) and executes them in order.
`void` | `init(javax.servlet.FilterConfig config)` Initialize all the filters, calling each one's init method in turn in the order supplied.
`void` | `setFilters(java.util.List<? extends javax.servlet.Filter> filters)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CompositeFilter

    public CompositeFilter()

Method Detail

### setFilters

    public void setFilters(java.util.List<? extends javax.servlet.Filter> filters)

### destroy

    public void destroy()

  Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.

  Specified by:
    `destroy` in interface `javax.servlet.Filter`
  See Also:
    `Filter.init(FilterConfig)`

### init

    public void init(javax.servlet.FilterConfig config)
              throws javax.servlet.ServletException

  Initialize all the filters, calling each one's init method in turn in the order supplied.

  Specified by:
    `init` in interface `javax.servlet.Filter`
  Throws:
    `javax.servlet.ServletException`
  See Also:
    `Filter.init(FilterConfig)`

### doFilter

    public void doFilter(javax.servlet.ServletRequest request,
                         javax.servlet.ServletResponse response,
                         javax.servlet.FilterChain chain)
                  throws java.io.IOException,
                         javax.servlet.ServletException

  Forms a temporary chain from the list of delegate filters supplied (`setFilters(List)`) and executes them in order. Each filter delegates to the next one in the list, achieving the normal behaviour of a `FilterChain`, despite the fact that this is a `Filter`.

  Specified by:
    `doFilter` in interface `javax.servlet.Filter`
  Throws:
    `java.io.IOException`
    `javax.servlet.ServletException`
  See Also:
    `Filter.doFilter(ServletRequest, ServletResponse, FilterChain)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD