On 3/29/06, Michael Bauroth <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've seen through the examples different ways to place filters. Which
> way do you would advice?


The way #2 is the correct one.  The way #1 prohibits you from using your
handler on VM-pipe transport.  If your handler is supposed to work only on a
certain transport type, then it's fine with #1, too, but who knows? :)

Trustin

way 1)
>
> public class ReverseProtocolHandler extends IoHandlerAdapter
> {
>      private static IoFilter LOGGING_FILTER = new LoggingFilter();
>      private static IoFilter CODEC_FILTER =
>          new ProtocolCodecFilter( new TextLineCodecFactory() );
>
>      public void sessionCreated( IoSession session ) throws Exception
>      {
>          session.getFilterChain().addLast( "logger", LOGGING_FILTER );
>          session.getFilterChain().addLast( "codec", CODEC_FILTER );
>      }
>
>
> way 2)
>
>         IoAcceptor tAcceptor = new SocketAcceptor();
>         IoAcceptorConfig tConfig = new SocketAcceptorConfig();
>         DefaultIoFilterChainBuilder tChain = tConfig.getFilterChain();
>          tChain.addLast( "logger", new LoggingFilter() );
>
>
> Regards
> Michael
>



--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to