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

2015-03-20 Thread Marc-Andre Bruneau
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+unsubscr...@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.


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

2015-03-20 Thread Thad Humphries
Solutions depend on when you want load the JSON files and who loads them. 
If the user is to pick the file, use the FileUpload widget to load the file 
to the server, then send it right back to your client (maybe after some 
server side safety checking). If the JSON files are restricted to an 
administrator, you could control the file upload by your application's 
authentication scheme. Alternately, you could define the JSON file (or 
files) in the application's servlet context (with Tomcat, 
META-INF/context.xml in your WAR). When the app deploys, the administrator 
would edit $CATALINA_BASE/conf/Catalina/[hostname]/[appname].xml to give 
the file's full path.

On Thursday, March 19, 2015 at 3:06:29 PM UTC-4, 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+unsubscr...@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.