Upon further investigation, I believe the DemuxingProtocolDecoder would have the same problem that I am experiencing if the finishDecode() method was called. Any message decoder used by the DemuxingProtocolDecoder would never receive the data that the CumulativeProtocolDecoder is storing in it's buffer when finishDecode() is called.
Has anyone else found a work around? Is the only solution to have my message decoder store it's own data? Do I have to duplicate the buffer attributeKey? Thanks, Andy ----- Original Message ---- From: Andy Ruch <[email protected]> To: [email protected] Sent: Tuesday, February 17, 2009 4:55:03 PM Subject: finishDecode() Hello, I'm using Mina 2.0 M4. I'm doing some processing on HTTP messages. I've implemented a protocol decoder that extends CumulativeProtocolDecoder. I also have some MessageDecoders that are called from my protocol decoder (very similar to DemuxingProtocolDecoder). I'm trying to handle the case where the HTTP session is closed in order to terminate the message. I believe the finishDecode() method was designed for this purpose. It even mentions it in the javadoc. When this method is invoked, how do I get the buffer holding the rest of my data from the CumulativeProtocolDecoder? I understand that it's an attribute in the session, but the BUFFER AttributeKey is a private field inside CumulativeProtocolDecoder. It seems like bad programming practice to duplicate the key in my code, especially if it ever gets changed in CumulativeProtocolDecoder. Do I need to write my own CumulativeProtocolDecoder so I can access the buffer? It seems like the finishDecode() method in CumulativeProtocolDecoder needs to pass the buffer, similar to some of the abstract finishDecode() methods in the DecodingState classes. I expect that whatever method I use to get the buffer into my protocol decoder can also be used to get the buffer into my MessageDecoder since it has the same finishDecode() method. Thanks. Andy
