Hi,
I've written a decoder extending the old HttpRequestDecoder. Now I want
to do some extra stuff with the already decoded headers and content,
before I forward the data to the handler. I thought, that the way to do
this is to override the finishDecode method (use the normal parsing
stuff, do my own right before sending, send it).
Please see my sample code for explanation. Is this the right way? And if
it is here comes my problem: The HttpRequestDecodingState is only
defined as friendly class in the codec package and not visible from
outside. What would you suggest?
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 some own logic here
* e.g. modify some data or build new data
*/
Object o = doLogic( m );
out.write( o == null ? m : o );
}
return null;
}
});
}
}
Best Regards
Michael