Hi Michael,
Sorry for the late answer.
On 4/15/06, Michael Bauroth <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've implemented the first decoders and registered it to my
> DemuxingProtocolCodecFactory. Now happen three questions to me:
>
> 1. I don't want to decode all incoming data with this "demuxer".
> Unfortunately the factory throws an exception when no appropiate decoder
> was found. Is it correct and "conform", when I ignore this exception in
> my SessionHandler? Will the decoding process for this ByteBuffer data
> then continue with the next stage decoder (next in chain)?
DemuxingProtocolCodecFactory cannot pass uninterpreted ByteBuffer because it
cannot determine where the unknown message starts and ends. You have to add
a MessageDecoder which writes the unknown part of the ByteBuffer to
ProtocolDecoderOutput, then you can handle it in the next codec filter or
handler.
2. When you confirm with 1., what do you recommend for the method
> doDecode in the DemuxingProtocolCodecFactory (see code snippet):
>
> <code>
> if( undecodables == decoders.length )
> {
> // Throw an exception if all decoders cannot decode data.
> String dump = in.getHexDump();
> in.position( in.limit() ); // Skip data
> throw new ProtocolDecoderException(
> "No appropriate message decoder: " + dump );
> }
> </code>
>
> The line <code>in.getHexDump();</code> leads here in an unneeded extra
> penalty?
What do you mean by 'unneeded extra penalty'?
3. I want to use two demuxers one after the other in a chain. The
> desired behaviour should be, that the second demuxer in a chain uses the
> generated ProtocolOutput from the previous decoder to work on it
> instead of (or additionally to) the ByteBuffer parsing. What is the
> right way to solve this? Must I store the results from the first decoder
> as a session attribute and reuse it in the second decoder? Or leads this
> in broken Mina design principles. Have you eventually a better solution
> for me?
Please try the solution I mentioned in the first answer.
My answer might not be that sufficient, but lets keep figuring out how MINA
can help you. :)
HTH,
Trustin
--
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