Trustin Lee wrote: > > 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()); > >
This worked, so now my http client is fixed. If I were to use the same HTTPResponse/Request objects on my server side (instead of the classes in http server example) - can you give some pointers what need to be done to do the conversion. Would the same HttpCodecFactory I used on client side work on the server side? Monika -- View this message in context: http://www.nabble.com/AsyncWeb-HTTP-codec-is-in-mina-filter-codec-http-now.-tf4833201s16868.html#a13952973 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
