Yves Harms wrote:
> Did I understand you right ?
> To enable Compression I just have to enable http-Compression with my
> servlet-container (Tomcat).
Yes, if your hessian client handles the http/gzip encoding combo.
> Hessian-Cpp will handle it automaticly.
>
Unfortunately no. In hessianc++ we chose to simply evaluate the hessian response
length in the http/hessian/servlet and if larger than a predefined amount to
compress the whole bitstream and send that back instead. This way the client
needs not have a smart HTTP library that properly implements Accept-Encoding:
headers, but instead reads the reply in and tests it for a GZip stream
signature. If found, it decompresses and the puts the result through the hessian
decoding code. If not found it just puts the input (i.e. the server reply)
through the hessian decoding code.
The Accept-Encoding/Content-Encoding scheme works extremely well with Flash, as
Flash uses the browser to perform HTTP requests, and most modern browsers
express their availability to process gzipped streams by sending in
Accept-Encoding themselves. In turn the server (if configured to do so) will
reply with "Content-Encoding: gzip" and then compress whatever comes from the
application, in this case a hessian bitstream. The browser decompresses and
Flash gets the "clean" reply either way, so you get hessian message compression
with no code.
The thing about hessianc++ is that it uses a hand-written, 2 code paths HTTP
abstraction that uses either OpenSSL or vanilla sockets, and is able to parse
properly formatted, Content-length: set or not HTTP replies. All it does is look
for the content-length or the double newlines and then extract everything from
there down. This means that fancy stuff like 100/Continues, if sent for whatever
reason, may fail to be properly interpreted. It also means that the code is
small and easy to understand and it's one less dependency. If I were to
integrate with a proper HTTP library, in C++ that is, I'd probably go for either
curl or neon. Then we'd get transparent compression as well in the c++ code.
For the time being, modifying the servlet to compress the reply and adding the
little decoding bit in the client is good enough. Contributions are welcome !
> Does Hessian-Java support this, too ?
>
As far as I can see, the hessian Java client uses URL.openConnection(). This
works out of the box for http: and jar: URL types. To get it to work with SSL
you'd need to set a system property and have some classes at hand to implement
SSL handling.
Now, I'm quite sure that this will not work out of the box with gzipped http
streams. You'd have to get into the HessianProxyFactory.java where it opens the
URL connection and process the stream beforehand (i.e. add a GzipInputStream
around it or something like that, you figure it out :) ).
> Thanks,
> Yves
>
Cheers,
-- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243
This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:16:41 PDT