Friday, March 20, 2015

Re: How to load a json file on client side without clientbundle?

Hi,

The solution I use is with a RequestBuilder.

String url = FULLPATH + "yourfile.json";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);

try {
  builder.sendRequest(null, new RequestCallback() {

    @Override
    public void onError(Request request, Throwable exception) {
      // ...
    }

    @Override
    public void onResponseReceived(Request request, Response response) {
      // ... some validation
      JSONValue jsonConfig = JSONParser.parseStrict(response.getText());
      // ...
    }
  }
} catch (RequestException e) {}

Hope this helps.

On Thursday, March 19, 2015 at 12:06:29 PM UTC-7, Dr.Doom wrote:
Hi,

I need an offline solution for my gwt project and i thought i can just put the data as json files as resources in my project.

Is there a way to load this json files on the client side?
i only found the way with clientbundle, but then i cant modify the json data files without recompiling the project.





Thx for the answers ;)

--
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