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)?
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?
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?
Any suggestions are very welcome!
Best Regards
Michael