List of usage examples for com.google.gwt.http.client RequestBuilder GET
Method GET
To view the source code for com.google.gwt.http.client RequestBuilder GET.
Click Source Link
From source file:n3phele.client.CacheManager.java
License:Open Source License
public void test(String username, String password, RequestCallback requestCallback) { // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.request(RequestBuilder.GET, ServiceAddress + "user/byName?id=" + URL.encodeQueryString(username), username, password); GWT.log("Sending authentication test request"); Request request = null;//from w w w . jav a 2 s .c om try { request = builder.sendRequest(null, requestCallback); } catch (RequestException e) { requestCallback.onError(request, e); } }
From source file:n3phele.client.CacheManager.java
License:Open Source License
protected void refreshClouds() { RequestBuilder builder = AuthenticatedRequestFactory.newCacheManagerRequest(RequestBuilder.GET, cloudUrl); try {/*from w w w . jav a2 s.c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Collection<Cloud> p = Cloud.asCollection(response.getText()); clouds.clear(); clouds.addAll(p.getElements()); GWT.log("Got " + clouds.size() + " clouds."); gotClouds = true; eventBus.fireEvent(new CloudListUpdate(cloudUrl)); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); gotClouds = false; } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.AbstractActivityProgressActivity.java
License:Open Source License
public void refresh(int start) { String url = collectionUrl;/*from w ww . j av a2 s . c om*/ url += "?summary=true&start=" + start + "&end=" + (start + pageSize - 1); this.start = start; // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { GWT.log("got progress"); Collection<Progress> c = Progress.asCollection(response.getText()); updateData(c.getUri(), c.getElements(), c.getTotal()); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.AbstractActivityProgressActivity.java
License:Open Source License
protected void refresh(String key) { String url = URL.encode(key + "?summary=true"); // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try {/*from w w w. ja v a 2s .co m*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Progress p = Progress.asProgress(response.getText()); updateData(p.getUri(), p); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.AbstractCloudProcessActivity.java
License:Open Source License
public void refresh(int start) { String url = buildUrlForProcesses(start); this.start = start; final int total = this.total; // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try {/* w ww . j ava 2 s.c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { GWT.log("got cloudProcess"); Collection<CloudProcessSummary> c = CloudProcessSummary.asCollection(response.getText()); int collectionSize = total; if (collectionSize == 0) { collectionSize = c.getTotal(); } updateData(c.getUri(), c.getElements(), collectionSize); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.AbstractCloudProcessActivity.java
License:Open Source License
protected void refresh(String key) { String url = URL.encode(key + "?summary=true"); // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try {//from w w w. ja va2s . co m builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { CloudProcessSummary p = CloudProcessSummary.asCloudProcessSummary(response.getText()); updateData(p.getUri(), p); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.AccountActivity.java
License:Open Source License
public void getAccount() { // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, accountUri); try {/* w w w .j a v a 2s .co m*/ Request request = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { // displayError("Couldn't retrieve JSON "+exception.getMessage()); } public void onResponseReceived(Request request, Response response) { GWT.log("Got reply"); if (200 == response.getStatusCode()) { Account account = Account.asAccount(response.getText()); updateAccount(account); } else { } } }); } catch (RequestException e) { //displayError("Couldn't retrieve JSON "+e.getMessage()); } }
From source file:n3phele.client.presenter.AccountListActivity.java
License:Open Source License
public void getAccountList() { // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, accountCollection); try {/*from w w w. ja v a 2s . c o m*/ Request request = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { // displayError("Couldn't retrieve JSON "+exception.getMessage()); } public void onResponseReceived(Request request, Response response) { GWT.log("Got reply"); if (200 == response.getStatusCode()) { Collection<Account> account = Account.asCollection(response.getText()); updateAccountList(account.getElements()); } else { } } }); } catch (RequestException e) { //displayError("Couldn't retrieve JSON "+e.getMessage()); } }
From source file:n3phele.client.presenter.ActivtiyActivity.java
License:Open Source License
protected void refreshActivity(String key) { String url = key;/*from w ww . j a v a 2 s . c om*/ // String url = objectUri; // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { ActivtiyActivity.this.activity = Activity.asActivity(response.getText()); ActivtiyActivity.this.objectUri = activity.getCommand(); ActivtiyActivity.super.initData(); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }
From source file:n3phele.client.presenter.CommandActivity.java
License:Open Source License
protected void refresh(String key) { String url = key;/*from w w w .j ava2 s . c o m*/ // String url = objectUri; // Send request to server and catch any errors. RequestBuilder builder = AuthenticatedRequestFactory.newRequest(RequestBuilder.GET, url); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { GWT.log("Couldn't retrieve JSON " + exception.getMessage()); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Command p = Command.asCommand(response.getText()); updateData(p.getUri(), p); } else { GWT.log("Couldn't retrieve JSON (" + response.getStatusText() + ")"); } } }); } catch (RequestException e) { GWT.log("Couldn't retrieve JSON " + e.getMessage()); } }