RequestBuilder and compressed xml file

197 views
Skip to first unread message

bradrover

unread,
Mar 30, 2010, 4:32:51 PM3/30/10
to Google Web Toolkit
I have some larger xml files than I 'd like, but I need to pull them
down and parse them client side. If I zip these up can I still use
RequestBuilder to get the content to the client and deflate it, or is
there a better way ?

Sripathi Krishnan

unread,
Mar 30, 2010, 6:42:23 PM3/30/10
to google-we...@googlegroups.com
You don't have to do anything special on the client side - the browser will automatically deflate it before you get the content. Just make sure that your server side code respects accept-encoding request header before sending down a compressed file.


--Sri



--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


bradrover

unread,
Mar 30, 2010, 8:18:43 PM3/30/10
to Google Web Toolkit
I'm probably doing this wrong,but I compressed the xml file to a zip,
when I request the zip file using RequestBiulder in hosted mode
running Chrome it crashes the plug-in.

com.google.gwt.dev.shell.BrowserChannel$RemoteDeathError: Remote
connection lost
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:
1730)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
165)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
120)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
507)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
264)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:
1668)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
401)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
222)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.SocketException: Connection reset by peer: socket
write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:
92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
123)
at java.io.DataOutputStream.flush(DataOutputStream.java:106)
at com.google.gwt.dev.shell.BrowserChannel
$ReturnMessage.send(BrowserChannel.java:1341)
at com.google.gwt.dev.shell.BrowserChannel
$ReturnMessage.send(BrowserChannel.java:1346)
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:
1716)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
165)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
120)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
507)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
264)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:
1668)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
401)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
222)
at java.lang.Thread.run(Thread.java:619)

On Mar 30, 6:42 pm, Sripathi Krishnan <sripathikrish...@gmail.com>
wrote:


> You don't have to do anything special on the client side - the browser will
> automatically deflate it before you get the content. Just make sure that
> your server side code respects accept-encoding request header before sending
> down a compressed file.
>
> --Sri
>
> On 31 March 2010 02:02, bradrover <brk...@gmail.com> wrote:
>
>
>
> > I have some larger xml files than I 'd like, but I need to pull them
> > down and parse them client side. If I zip these up can I still use
> > RequestBuilder to get the content to the client and deflate it, or is
> > there a better way ?
>
> > --
> > 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-we...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>

bradrover

unread,
Mar 30, 2010, 9:20:44 PM3/30/10
to Google Web Toolkit
Well forget that error message... I'm just trying to figure out now
why my RequestBuilder Accept-Enc0ding header is not being used. I add
this code:

requestBuilder.setHeader("Accept-Encoding", "gzip, deflate");

and I get this result in chrome for request headers:

Referer:http://localhost:8080/SdssThinClient/sdssthinclient/
C72C3F6B8BCFC032CD4680AC42BFDF51.cache.html
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/
533.3 (KHTML, like Gecko) Chrome/5.0.360.4 Safari/533.3

seems like this is pretty straightforward, so i don't get it....

Sripathi Krishnan

unread,
Mar 31, 2010, 4:35:36 AM3/31/10
to google-we...@googlegroups.com
You don't have to set the Accept-Encoding header yourself. The browser will automatically be set the header if it understands gzip. Your client code doesn't have to change at all to handle gzip.

On the server side, you do the following  -
  1. Check if the browser understands gzip
  2. If yes, actually compress the response and set the appropriate header to indicate its a compressed stream
  3. If no, send uncompressed header
See GWTs Server code that does this logic -
  1. http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java?spec=svn5731&r=5731#306
  2. http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/server/rpc/RPCServletUtils.java?r=1538#178

--Sri


To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

bradrover

unread,
Mar 31, 2010, 9:15:41 AM3/31/10
to Google Web Toolkit
Thanks Sri! This is excellent.

Brad

On Mar 31, 4:35 am, Sripathi Krishnan <sripathikrish...@gmail.com>
wrote:


> You don't have to set the Accept-Encoding header yourself. The browser will
> automatically be set the header if it understands gzip. Your client code
> doesn't have to change at all to handle gzip.
>
> On the server side, you do the following  -
>

>    1. Check if the browser understands gzip
>    2. If yes, actually compress the response and set the appropriate header


>    to indicate its a compressed stream

>    3. If no, send uncompressed header


>
> See GWTs Server code that does this logic -
>

>    1.
>    http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...
>    2.
>    http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...

> > > > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com><google-web-toolkit%2Bunsubs

Reply all
Reply to author
Forward
0 new messages