Trustin Lee wrote: > > Hi folks, > > I've just succeeded to import AsyncWeb HTTP codec into > mina-filter-codec-http submodule in trunk. I had to rewrite the > client side codec, but it seems like it's working OK. Please note > this is a massive change so you might see a lot of compilation errors > if you were using the HTTP client codec in the trunk. The notable > changes are mostly renaming: HttpProtocolCodecFactory -> > HttpCodecFactory, HttpRequestMessage -> HttpRequest, > HttpResponseMessage -> HttpResponse. You will also find subtle > differences in message model, but it should be easy to follow up. > > Cheers, > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP Key ID: 0x0255ECA6 > >
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); ------begin contentString------ HTTP/1.1 200 OK Connection: keep-alive Date: Wed, 21 Nov 2007 14:29:01 EST Keep-Alive: 200 Content-Type: text/plain Server: HttpServer (Test HTTP Server) Last-Modified: Wed, 21 Nov 2007 14:29:01 EST Cache-Control: private Content-Length: 171 sample body --------------end contentString-------- Old getStringContent() would have returned just ---sample body--- Was that done intentionally and if yes, do you think, you can you provide a convenience method for getting just the body (as String ??). For clarification, on client side I am using the latest HTTPRequest/Response/Codec code from mina-filter-codec-http, but on the server side I am still using the code from examples/httpserver. Thanks, Monika Adamczyk -- View this message in context: http://www.nabble.com/AsyncWeb-HTTP-codec-is-in-mina-filter-codec-http-now.-tf4833201s16868.html#a13884815 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
