org.apache.mina.common

Class DefaultIoFilterChainBuilder

Implemented Interfaces:
Cloneable, IoFilterChainBuilder

public class DefaultIoFilterChainBuilder
extends java.lang.Object
implements IoFilterChainBuilder, Cloneable

The default implementation of IoFilterChainBuilder which is useful in most cases. DefaultIoFilterChainBuilder has an identical interface with IoFilter; it contains a list of IoFilters that you can modify. The IoFilters which are added to this builder will be appended to the IoFilterChain when buildFilterChain(IoFilterChain) is invoked.

However, the identical interface doesn't mean that it behaves in an exactly same way with IoFilterChain. DefaultIoFilterChainBuilder doesn't manage the life cycle of the IoFilters at all, and the existing IoSessions won't get affected by the changes in this builder. IoFilterChainBuilders affect only newly created IoSessions.

 IoAcceptor acceptor = ...;
 DefaultIoFilterChainBuilder builder = acceptor.getFilterChain();
 builder.addLast( "myFilter", new MyFilter() );
 ...
 

Fields inherited from interface org.apache.mina.common.IoFilterChainBuilder

NOOP

Constructor Summary

DefaultIoFilterChainBuilder()
Creates a new instance with an empty filter list.

Method Summary

void
addAfter(String baseName, String name, IoFilter filter)
void
addBefore(String baseName, String name, IoFilter filter)
void
addFirst(String name, IoFilter filter)
void
addLast(String name, IoFilter filter)
void
buildFilterChain(IoFilterChain chain)
Modifies the specified chain.
void
clear()
Object
clone()
boolean
contains(IoFilter> filterType)
boolean
contains(String name)
boolean
contains(IoFilter filter)
IoFilter
get(String name)
List
getAll()
List
getAllReversed()
IoFilterChain.Entry
getEntry(String name)
IoFilter
remove(String name)
String
toString()

Constructor Details

DefaultIoFilterChainBuilder

public DefaultIoFilterChainBuilder()
Creates a new instance with an empty filter list.

Method Details

addAfter

public void addAfter(String baseName,
                     String name,
                     IoFilter filter)

addBefore

public void addBefore(String baseName,
                      String name,
                      IoFilter filter)

addFirst

public void addFirst(String name,
                     IoFilter filter)

addLast

public void addLast(String name,
                    IoFilter filter)

buildFilterChain

public void buildFilterChain(IoFilterChain chain)
            throws Exception
Modifies the specified chain.
Specified by:
buildFilterChain in interface IoFilterChainBuilder

clear

public void clear()
            throws Exception

clone

public Object clone()

contains

public boolean contains(IoFilter> filterType)
See Also:
IoFilterChain.contains(Class)

contains

public boolean contains(String name)

contains

public boolean contains(IoFilter filter)

get

public IoFilter get(String name)

getAll

public List getAll()

getAllReversed

public List getAllReversed()

getEntry

public IoFilterChain.Entry getEntry(String name)

remove

public IoFilter remove(String name)

toString

public String toString()