You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Michael Bauroth <Mi...@falcom.de> on 2008/02/27 16:27:35 UTC

Spam (low): Problem with extending HttpRequestDecoder

Hi,

I need (or want) to decode the content of the http request itself in a 
own decoder extending the old HttpRequestDecoder. The reason is, that I 
have  already some other acceptor / decoder pairs, which all decode the 
incoming stuff in the same message objects and bind to a unique 
SessionHandler.

I thought, that I only have to overwrite the finishDecode method from 
HttpRequestDecodingState to get all raw parts of the request, convert it 
to my own message objects and forward them afterwards to the 
ProtocolDecoderOutput.

Unfortunately the HttpRequestDecodingState is only a friendly defined 
class in the codec package and not visible from outside. Am I missing 
something or is there a mistake in my understanding?


public class OwnRequestDecoder extends HttpRequestDecoder
{
   public OwnRequestDecoder()
   {
     super( new HttpRequestDecodingState()
     {
       @Override
       protected DecodingState finishDecode(List<Object> childProducts, 
ProtocolDecoderOutput out) throws Exception
       {
         for (Object m: childProducts)
         {
           // do something with the data
           // then write them out
           out.write(m);
         }
         return null;
       }
     });
   }
}


Hope that somebody has a helpful hint for me.


Best Regards
Michael