You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Paul Vitic <pa...@vitic.biz> on 2007/10/21 11:33:38 UTC

Newbie Question MessageDecoderResult.NOT_OK

Given that there are multiple MessageDecoderAdapter subclass implementations
in a filterchain what happens when the decode method of the first filter in
the chain returns MessageDecoderResult.NOT_OK? Is the ByteBuffer handed over
to the next filter in the chain or is the message processing stopped?

-- 
View this message in context: http://www.nabble.com/Newbie-Question-MessageDecoderResult.NOT_OK-tf4665458s16868.html#a13327426
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Newbie Question MessageDecoderResult.NOT_OK

Posted by Trustin Lee <tr...@gmail.com>.
On 10/23/07, Paul Vitic <pa...@vitic.biz> wrote:
> Niklas Therning wrote:
> >
> > Paul Vitic wrote:
> >> I have just realised that it is not allowed to implement more than one
> >> ProtocolCodecFilter in a filter chain. So what is the best way to decode
> >> a
> >> message which has multiple protocol layers. I.e. a proprietary
> >> application
> >> level protocol enveloped inside another proprietary application level
> >> protocol enveloped inside http. The tricky part is that the messages
> >> sometimes come from an http client in this way and sometimes come from a
> >> TCP
> >> client only enveloped by the last layer of proprietary application level
> >> protocol. Should I extend the sample http request decoder?
> >>
> > IIRC this has been fixed in trunk. What version of MINA are you using?
> > If you try out the latest version from Subversion you should be able to
> > add more than one ProtocolCodecFilter to your chain, if I'm not mistaken.
>>
> I am using version 1.1.3 and I receive this error. Should i go to a higher
> version?

This issue won't be fixed in 1.x.  We already have fixed it in trunk
(2.0), but we won't backport it for a backward compatibility reason.
Please use the workaround I suggested meanwhile.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: Newbie Question MessageDecoderResult.NOT_OK

Posted by Paul Vitic <pa...@vitic.biz>.


Niklas Therning wrote:
> 
> Paul Vitic wrote:
>> I have just realised that it is not allowed to implement more than one
>> ProtocolCodecFilter in a filter chain. So what is the best way to decode
>> a
>> message which has multiple protocol layers. I.e. a proprietary
>> application
>> level protocol enveloped inside another proprietary application level
>> protocol enveloped inside http. The tricky part is that the messages
>> sometimes come from an http client in this way and sometimes come from a
>> TCP
>> client only enveloped by the last layer of proprietary application level
>> protocol. Should I extend the sample http request decoder?
>>   
> IIRC this has been fixed in trunk. What version of MINA are you using? 
> If you try out the latest version from Subversion you should be able to 
> add more than one ProtocolCodecFilter to your chain, if I'm not mistaken.
> 
> 
> HTH
> /Niklas
> 
> 
> 
I am using version 1.1.3 and I receive this error. Should i go to a higher
version?
-- 
View this message in context: http://www.nabble.com/Newbie-Question-MessageDecoderResult.NOT_OK-tf4665458s16868.html#a13358650
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Newbie Question MessageDecoderResult.NOT_OK

Posted by Trustin Lee <tr...@gmail.com>.
On 10/22/07, Niklas Therning <ni...@trillian.se> wrote:
> Paul Vitic wrote:
> > I have just realised that it is not allowed to implement more than one
> > ProtocolCodecFilter in a filter chain. So what is the best way to decode a
> > message which has multiple protocol layers. I.e. a proprietary application
> > level protocol enveloped inside another proprietary application level
> > protocol enveloped inside http. The tricky part is that the messages
> > sometimes come from an http client in this way and sometimes come from a TCP
> > client only enveloped by the last layer of proprietary application level
> > protocol. Should I extend the sample http request decoder?

If you wrote a protocol codec for HTTP, the HTTP message instance
should contain a ByteBuffer (content).  Now you need to decode the
ByteBuffer which is encoded in some proprietary encoding.  Write a
custom IoFilter that gets the ByteBuffer from the HTTP message object
and sets the decoded data back to the HTTP message object.  You can
even write more filters to implement multi-layered protocols.

> IIRC this has been fixed in trunk. What version of MINA are you using?
> If you try out the latest version from Subversion you should be able to
> add more than one ProtocolCodecFilter to your chain, if I'm not mistaken.

Yes.  Please let me know if it doesn't work as expected.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: Newbie Question MessageDecoderResult.NOT_OK

Posted by Niklas Therning <ni...@trillian.se>.
Paul Vitic wrote:
> I have just realised that it is not allowed to implement more than one
> ProtocolCodecFilter in a filter chain. So what is the best way to decode a
> message which has multiple protocol layers. I.e. a proprietary application
> level protocol enveloped inside another proprietary application level
> protocol enveloped inside http. The tricky part is that the messages
> sometimes come from an http client in this way and sometimes come from a TCP
> client only enveloped by the last layer of proprietary application level
> protocol. Should I extend the sample http request decoder?
>   
IIRC this has been fixed in trunk. What version of MINA are you using? 
If you try out the latest version from Subversion you should be able to 
add more than one ProtocolCodecFilter to your chain, if I'm not mistaken.


HTH
/Niklas


Re: Newbie Question MessageDecoderResult.NOT_OK

Posted by Paul Vitic <pa...@vitic.biz>.
I have just realised that it is not allowed to implement more than one
ProtocolCodecFilter in a filter chain. So what is the best way to decode a
message which has multiple protocol layers. I.e. a proprietary application
level protocol enveloped inside another proprietary application level
protocol enveloped inside http. The tricky part is that the messages
sometimes come from an http client in this way and sometimes come from a TCP
client only enveloped by the last layer of proprietary application level
protocol. Should I extend the sample http request decoder?
-- 
View this message in context: http://www.nabble.com/Newbie-Question-MessageDecoderResult.NOT_OK-tf4665458s16868.html#a13342150
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.