Re: AsyncWeb HTTP codec is in mina-filter-codec-http now.

2007-11-26 Thread monika7


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.



Re: AsyncWeb HTTP codec is in mina-filter-codec-http now.

2007-11-21 Thread monika7


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.



Re: MINA for HTTP

2007-09-26 Thread monika7



Mark Webb-4 wrote:
 
 If you are using the trunk, check out the protocol-http-server and
 filter-codec-http subprojects.
 
 

I checkout yesterday the trunk code from
https://svn.apache.org/repos/asf/mina/trunk/
and the no classes under the protocol-http-server. The directory listed
below is empty. 
https://svn.apache.org/repos/asf/mina/trunk/protocol-http-server/src/main/java/org/apache/mina/protocol/http/server

Can someone check the svn respository and make sure all the code is checked
in? 

Monika

-- 
View this message in context: 
http://www.nabble.com/MINA-for-HTTP-tf4481259s16868.html#a12908114
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.