RE: ZipException with Restet 2.1 RC6

2012-09-11 Thread Tal Liron
OK, I now understand what is causing these exception and would like to suggest 
a solution in Restlet.

The issue is in Restlet's ReadableChunkingChannel. In order to chunk an 
existing representation, it needs to first decode it if it's encoded. In the 
case of Encoding.DEFLATE, it would thus use an InflaterInputStream instance.

Unfortunately, there are two incompatible versions of the DEFLATE algorithm. 
The default in the JVM is to use wrap mode, but you can explicitly set 
nowrap mode like so:

new InflaterInputStream(stream, new Inflater(true))

Even more unfortunately, certain versions of Microsoft's Internet Explorer only 
support the nowrap mode. So, you absolutely *must* set the nowrap flag if 
you want to support IE when generating your own encoded Restlet representations.

So, what can Restlet do about this?

There can be two Encoding constants, one for each supported mode. The usual 
DEFLATE, and perhaps DEFLATE_NOWRAP. In terms of outgoing HTTP headers, they 
should be identical, but the Restlet stack should be able to maintain the 
correct version of algorithm throughout, for example in 
ReadableChunkingChannel. (It must also re-encode the chunk in the correct 
version of the algorithm.)

A simpler solution may be to simply use nowrap always in Restlet. I've done 
this in my pre-2.1 Restlet applications in order to support IE properly. But, 
there are advantages to allowing developers some control over this.

A related side question: Is there be a way to avoid the decoding-re-encoding 
done by ReadableChunkingChannel? Specifically, is there a way to send the 
representation already chunked from the ServerResource?

-Tal

 I'm getting these exceptions occasionally on a few specific resources, not 
 sure yet how to reproduce. Has anyone else seen them and have any information?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3005128


RE: ZipException with Restet 2.1 RC6

2012-09-11 Thread Tal Liron
I'll just quickly point out there is *another* bug here.

Because Restlet's EncodeRepresentation class does not use nowrap encoding, 
DEFLATE encoding will be broken for certain versions of Internet Explorer.

This bug may well very have existed in Restlet for a long time.

-Tal

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3005141


ClientRestlet speed compare to apache Httpclient

2012-09-11 Thread zhoutao
i access a remote restlet server using ClientRestlet and Httpclient, the
clientresource seems to be 
slower than httpclient, i debug the open source,
BaseClientHelper.handle(Request request, Response response)'s

.. if (!latch.await(NioUtils.NIO_TIMEOUT, TimeUnit.MILLISECONDS)) {.
takes most of time.

who can show me the reason, and how to resovle the problem!
thanks!



--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/ClientRestlet-speed-compare-to-apache-Httpclient-tp7578359.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3005178