Do we ask the same questions?
http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a9946908


On 6/27/07, slowness chen <[EMAIL PROTECTED]> wrote:

I tried extending from ProtocolCodecFilter :

public class MyProtocolCodecFilter extends ProtocolCodecFilter{
   public MyProtocolCodecFilter(ProtocolCodecFactory factory) {
       super(factory);
   }
   public void onPreAdd( IoFilterChain parent, String name, NextFilter
nextFilter ) throws Exception
   {
   }
}

now the session is set up sucessfully,but only the first
ProtocolCodecFilter
's "decode" gets called.

On 6/26/07, Germán Borbolla Flores <[EMAIL PROTECTED]> wrote:
>
> Maybe you could extend from ProtocolCodecFilter and override onPreAdd,
> and remove the validation, I think that might just work.
>
> Germán Borbolla Flores wrote:
> > You cannot add more than one ProtocolCodecFilter:
> >
> > --- Taken from ProtocolCodecFilter.java
> >        if( parent.contains( ProtocolCodecFilter.class ) )
> >        {
> >            throw new IllegalStateException( "A filter chain cannot
> > contain more than one ProtocolCodecFilter." );
> >        }
> >
> > Maybe the exception is not getting caught.
> >
> >
> > slowness chen wrote:
> >> Hey guys,
> >>
> >> I  have multiple ProtocolCodecFilters:
> >>
> >>        SocketAcceptorConfig cfg = new SocketAcceptorConfig();
> >>        cfg.getSessionConfig().setReuseAddress( true );
> >>        cfg.getFilterChain().addLast( "codec1", new
ProtocolCodecFilter(
> >> new
> >> MyCodecFactory1( )));
> >>        cfg.getFilterChain().addLast( "codec2", new
ProtocolCodecFilter(
> >> new
> >> MyCodecFactory12( )));
> >>
> >> every filter works fine by itself, but if I use both, the server
> doesn't
> >> even go to the sessionCreated callback,
> >> and my socket client gets the following error sometimes:
> >>    socket.error: (10053, 'Software caused connection abort')
> >> or sometimes receives nothing and return.
> >>
> >> I am quite new to Mina, so any suggest may be helpful. Thanks.
> >>
> >> Best,
> >> Chen
> >>
>

Reply via email to