Hi Zmitro,
Glad to know that you figured this out. Either workaround would work, with
the following considerations:

1) If you go with setting the server to not zip responses with
"application/json" content-types, any other JSON data that is sent from your
server outside GWT RPC payloads won't be gzipped, which could hurt if you do
have other resources that are served under "application/json" content-types.

2) Overriding shouldCompressResponse() might be the better solution given
the caveat in 1). There is the possibility of handling this in GWT core, but
given that double-zipped responses is a specific enough corner-case, it
probably makes more sense to handle it on the server or in
application-specific server-side code.

Hope that helps,
-Sumit Chandel

On Tue, May 26, 2009 at 6:06 AM, Zmitro Lapcjonak <idob...@gmail.com> wrote:

>
> More details: the data is gzipped by GWT-RPC on server-side
> class RPCServletUtils
> writeResponse()
> {
>   byte[] responseBytes = responseContent.getBytes(CHARSET_UTF8);
>   ...
>   ByteArrayOutputStream output = new ByteArrayOutputStream
> (responseBytes.length);
>   gzipOutputStream = new GZIPOutputStream(output);
>   responseBytes = output.toByteArray();
>   ...
>   response.getOutputStream().write(responseBytes);
> }
>
> and then the zipped array was zipped second time
> by the SAP server:
>
> class GzipResponseStream
> public void write(byte b[], int off, int len)
> {
>   if( len <= buf.length )
>     System.arraycopy(b, off, buf, count, len);
>   else
>     gzipmultistream.write(servletoutput, b, off, len);
> }
>
> On the client-side the browser unzips the response only once
> (regardless of two "content-encoding: gzip" headers :)
>
> And then GWT-RPC client-side code tries to decode the response:
>
> class RequestCallbackAdapter
> onResponseReceived()
> {
>   String encodedResponse = response.getText();
>   // but the this is zipped json, not encoded text.
>   // and thus
>   caught = new InvocationException(encodedResponse);
> }
>
> So, as solution I can add "application/json" to list
> of content-types which are not zipped by the server.
> Or override the shouldCompressResponse() of
> RemoteServiceServlet and return false there.
>
> Additional solution is to create bug ticket to GWT-RPC
> client-side, which doesn't try to unzip response :)
>
>
> --
> Zmitro Lapcionak
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to