Hi Monica, On Nov 22, 2007 4:58 AM, monika7 <[EMAIL PROTECTED]> wrote: > I just discovered the new version of HTTPResponse vs old HTTPResponseMessage > and I noticed one difference in the outcome of getContent() method. > The original HTTPResponseMessage had getStringContent() method which > returned just the body of the message. If I use HTTPResponse.getContent and > convert the return IOBuffer to a String, I get the whole message, including > all http headers. I am enclosing below the output of the following code > where httpResponse is instance of DefaultHttpResponse class: > > IoBuffer content = httpResponse.getContent(); > byte[] contentBytes = content.array(); > String contentString = new String(contentBytes);
I think you have to do the following: IoBuffer content = httpResponse.getContent(); String contentString = content.getString(Charset.forName(...).newDecoder()); Please let me know if this doesn't work. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
