Monday, July 6, 2015

Re: Guidance on transmitting JSON data

Well, that question is not only valid for GWT, but for the web in general.

Is REST an option for you? You can use automatic serializers/deserializers on the server and on the client for JSON data if you wish.

I recommend restygwt on the client and Jersey (or RestEasy, or Restlet, or... <insert your framework of choice here>) on the server.

Talking about the size of the request or response: gzip is a good option, but as a rule of thumb you should try to split the data into smaller pieces. Not always possible, but worth a try.

On Monday, July 6, 2015 at 9:07:45 PM UTC-3, rjcarr wrote:
I have a javascript widget (note, not gwt widget) that takes a javascript object as input.  If I have the JSON representation of this object as a string I can turn it into a javascript object using JSON.parse() and everything works fine.

However, the data itself will be generated on the server.  From what I can tell, I have two options:

 * Create a GWT-RPC servlet and transfer the json as a string

 * Create a standard servlet, set the response type as "application/json", and then write the json as string to the response stream that's retrieved using a request builder

With both of these cases I'd be gzipping the response.  

I'm asking because the json response data can get quite large.  Are there any other options I'm missing?  Is there a binary / encoded option other than strings or is the gzipping good enough?

Generally, are there any best practices for transferring large json data using GWT?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment