Saturday, December 3, 2011

Re: Loading JSON Test Data

To handle the response you have a few options:


You can read the JSON response and pretty easily map it to the JS Overlay Type you've defined describing the JSON structure.


Similar as 1) above, just even cooler. At least for me :)

Your comment:

"in GWT it returns a status code 0" ...

You are running into the SOP (Same Origin Policy) here.

There are a couple of alternatives:


b) You can send the call to your server (running on the same domain, making sure you don't violate none of the SOP rules, different port,etc..) and from there send a call to your remote server.

c) You can load the test data from your domain backend server and then test from there so you don't run into the SOP issue using either 1) or 2) mentioned above.

There are might be other options, those come to mind right now.

Regards,

Alfredo


On Sat, Dec 3, 2011 at 8:54 AM, CSchulz <cschulz@acumeta.com> wrote:
I'm wondering if there's a way to have a json file, hosted locally or online, where I can create a bunch of test data and then load it into my GWT app and parse it like a RequestBuilder call. I've been looking online for a way to do this and nothing seems to work. I then tried putting together a php script to return some json, and even though it works in the browser and returns a 200 status code in my Charles web proxy, in GWT it returns a status code 0 and doesn't give me any data. The php file was not hosted locally and I have the php content type set to application/json. If there's another way to load this json that would be nice. I don't want to have to create these json objects from scratch in GWT.

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



--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton


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

No comments:

Post a Comment