<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ok - got this. Having an implementation like this - helped got past
the default visibility of 'decode' : <br>
<br>
<br>
new MyDecoder().decode(ctx, e.getChannel(), (ChannelBuffer)
e.getMessage() ); <br>
<br>
static class MyDecoder extends HttpRequestDecoder {<br>
<br>
public Object decode(ChannelHandlerContext ctx,<br>
Channel channel,<br>
ChannelBuffer buffer) <br>
throws Exception {<br>
return super.decode(ctx, channel, buffer, <br>
HttpMessageDecoder.State.READ_INITIAL);<br>
}<br>
} <br>
<br>
<br>
This worked great, but I wanted to reuse the ChannelBuffer after
decoding as well ( since after this the stream returns empty ). <br>
<br>
So , used the .copy() method of ChannelBuffer to take care of the
same. <br>
<br>
new MyDecoder().decode(ctx, e.getChannel(), (ChannelBuffer)
e.getMessage()<b>.copy()</b> ); <br>
<br>
That worked fine. <br>
<br>
But - is that an equivalent of a clear() method to force release the
contents though ? <br>
<br>
<br>
<br>
<br>
On 08/04/2011 01:06 AM, Renjith T wrote:
<blockquote cite="mid:4E39A324.6070306@gmail.com" type="cite">I am
working on a handler ( from SimpleChannelUpstreamHandler), that
gives the message in messageRecieved as a ChannelBuffer .
<br>
<br>
public void messageReceived(ChannelHandlerContext ctx, final
MessageEvent e)
<br>
throws Exception {
<br>
final ChannelBuffer request = (ChannelBuffer)
e.getMessage();
<br>
... // do something
<br>
<br>
}
<br>
<br>
<br>
I would like to convert this ChannelBuffer to a HttpRequest,
through some means, if possible.
<br>
<br>
( pipeline.addLast("decoder", new HttpRequestDecoder()); , in
the pipeline factory does not work since I need the raw
ChannelBuffer as mentioned above , for some other downstream
processing as well).
<br>
<br>
How can I achieve the above ?
<br>
<br>
<br>
<br>
</blockquote>
</body>
</html>