<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Ok - got this.&nbsp; Having an implementation like this - helped got past
    the default visibility of 'decode' : <br>
    <br>
    &nbsp; <br>
    &nbsp; new MyDecoder().decode(ctx, e.getChannel(), (ChannelBuffer)
    e.getMessage() ); <br>
    <br>
    &nbsp; static class MyDecoder extends HttpRequestDecoder {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public Object decode(ChannelHandlerContext ctx,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Channel channel,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChannelBuffer buffer) <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws Exception {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return super.decode(ctx, channel, buffer, <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpMessageDecoder.State.READ_INITIAL);<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
    &nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <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>
    &nbsp; 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>
      &nbsp;&nbsp;&nbsp; public void messageReceived(ChannelHandlerContext ctx, final
      MessageEvent e)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws Exception {
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final ChannelBuffer request&nbsp; = (ChannelBuffer)
      e.getMessage();
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... // do something
      <br>
      <br>
      &nbsp;&nbsp;&nbsp; }
      <br>
      <br>
      <br>
      I would like to convert this ChannelBuffer to a HttpRequest,
      through some means, if possible.
      <br>
      <br>
      (&nbsp;&nbsp; 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>