Example usage for com.google.gwt.http.client RequestBuilder GET

List of usage examples for com.google.gwt.http.client RequestBuilder GET

Introduction

In this page you can find the example usage for com.google.gwt.http.client RequestBuilder GET.

Prototype

Method GET

To view the source code for com.google.gwt.http.client RequestBuilder GET.

Click Source Link

Document

Specifies that the HTTP GET method should be used.

Usage

From source file:org.apache.cxf.management.web.browser.client.service.settings.RemoteStorageProxyImpl.java

License:Apache License

public void saveSettings(@Nonnull final RequestCallback callback) {
    RequestBuilder builder = buildRequest(RequestBuilder.GET, buildEndpointURL());
    execute(null, builder, callback);
}

From source file:org.apache.sling.explorer.client.sling.Sling.java

License:Apache License

public void retrieveSessionInfo(HTML sessionInfoUI) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, SESSION_INFO_URL);

    try {//ww  w.j  a va2  s  .com
        builder.sendRequest(null, new JsonTreeRequestCallback(sessionInfoUI));
        GWT.log("send request end", null);

    } catch (RequestException e) {

        GWT.log("Couldn't retrieve User Information", e);

    }
}

From source file:org.apache.sling.explorer.client.widgets.grid.resource.ResourceGrids.java

License:Apache License

public void populate(String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
            url + ExplorerConstants.JSON_CHILDREN_REQUEST_EXTENSION);

    try {/* ww w  .ja  va 2 s  .  c  o m*/
        builder.sendRequest(null, new JsonGridCallback(this));
    } catch (RequestException e) {
        // TODO : add message box for the end-user
        GWT.log("ResourceGrids - Couldn't retrieve JSON for url : " + url
                + ExplorerConstants.JSON_CHILDREN_REQUEST_EXTENSION, e);
    }
}

From source file:org.apache.sling.explorer.client.widgets.tree.resource.ResourceTree.java

License:Apache License

private void loadChildren(final TreeItem treeItem, final String url) {

    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);

    try {/*from ww w .  j  a  va2s. c o  m*/
        builder.sendRequest(null, new JsonTreeRequestCallback(treeItem));
    } catch (RequestException e) {
        // TODO : add message box for the end-user
        GWT.log("ResourceTree - Couldn't retrieve JSON for url : " + url
                + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION, e);
    }

}

From source file:org.apache.solr.explorer.client.core.manager.DefaultRequestManager.java

License:Apache License

public Request loadTextResource(String name, final AsyncCallback<String> callback) {
    String url = GWT.getHostPageBaseURL() + name;

    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);

    try {/*  ww w  .j  a v  a  2s  .  co  m*/

        return requestBuilder.sendRequest(null, new RequestCallback() {
            public void onResponseReceived(Request request, Response response) {
                callback.onSuccess(response.getText());
            }

            public void onError(Request request, Throwable exception) {
                callback.onFailure(exception);
            }
        });
    } catch (RequestException re) {
        callback.onFailure(re);
        return null;
    }
}

From source file:org.bonitasoft.console.client.admin.page.view.DeleteCustomPage.java

License:Open Source License

private void searchFormMappingDependenciesForPage(String pageId) {
    final Map<String, String> filter = new HashMap<String, String>();
    filter.put(ApplicationPageItem.ATTRIBUTE_PAGE_ID, pageId);
    RequestBuilder requestBuilder;/*from   w w w  .  j  av  a 2  s  . co  m*/
    requestBuilder = new RequestBuilder(RequestBuilder.GET, "../API/form/mapping?c=10&p=0&f=pageId=" + pageId);
    requestBuilder.setCallback(new DeletePageProblemFormCallback(pageId));
    try {
        requestBuilder.send();
    } catch (RequestException e) {
        e.printStackTrace();
    }
}

From source file:org.bonitasoft.console.client.user.task.action.CheckFormMappingAndDisplayPerformTaskPageAction.java

License:Open Source License

protected void searchFormMappingForTask(final TreeIndexed<String> parameters) {
    RequestBuilder requestBuilder;//from  www .  j a va  2s.  com
    final String processIdFilter = URL
            .encodeQueryString(PageItem.ATTRIBUTE_PROCESS_ID + "=" + processDefinitionId);
    final String taskNameFilter = URL.encodeQueryString(ATTRIBUTE_FORM_MAPPING_TASK + "=" + taskName);
    requestBuilder = new RequestBuilder(RequestBuilder.GET,
            "../API/form/mapping?c=10&p=0&f=" + processIdFilter + "&f=" + taskNameFilter);
    requestBuilder.setCallback(new FormMappingCallback(parameters));
    try {
        requestBuilder.send();
    } catch (final RequestException e) {
        GWT.log("Error while creating the from mapping request", e);
    }
}

From source file:org.bonitasoft.console.client.user.task.action.CheckFormMappingAndDisplayProcessInstanciationFormAction.java

License:Open Source License

protected void searchFormMappingForProcess(final TreeIndexed<String> parameters) {
    final String processId = parameters.getValue(ProcessItem.ATTRIBUTE_ID);
    RequestBuilder requestBuilder;/*from  w  w  w  .j  a va 2s. c  om*/
    final String processIdFilter = URL.encodeQueryString(PageItem.ATTRIBUTE_PROCESS_ID + "=" + processId);
    final String mappingTypeFilter = URL
            .encodeQueryString(ATTRIBUTE_FORM_MAPPING_TYPE + "=" + PROCESS_START_FORM_MAPPING);
    requestBuilder = new RequestBuilder(RequestBuilder.GET,
            "../API/form/mapping?c=10&p=0&f=" + processIdFilter + "&f=" + mappingTypeFilter);
    requestBuilder.setCallback(new FormMappingCallback(processId, parameters));
    try {
        requestBuilder.send();
    } catch (final RequestException e) {
        GWT.log("Error while creating the from mapping request", e);
    }
}

From source file:org.bonitasoft.console.client.view.DashboardPanel.java

License:Open Source License

/**
 * @param aResult/* ww  w.j  a va 2 s .  c om*/
 */
protected void displayReport(ReportItem aResult) {
    try {
        RequestBuilder theRequestBuilder = new RequestBuilder(RequestBuilder.GET,
                myReportingDataSource.buildReportURL(aResult, ReportScope.USER));
        theRequestBuilder.setCallback(new RequestCallback() {
            public void onError(Request aRequest, Throwable anException) {
                if (anException instanceof SessionTimeOutException) {
                    // reload the page.
                    Window.Location.reload();
                }
                myReportHTML.setHTML("");
                myOnGoingRequests--;
                nbOfErrors++;
                GWT.log("Unable to display report (error count:" + nbOfErrors + ")", anException);
                if (nbOfErrors >= 3) {
                    GWT.log("Disabling recurrent call after too many consecutive errors.", null);
                    myUpdateTimer.cancel();
                }
            }

            public void onResponseReceived(Request aRequest, Response aResponse) {
                if (1 == myOnGoingRequests) {
                    myReportHTML.setHTML("");
                    if (aResponse.getStatusCode() == Response.SC_OK) {
                        myReportHTML.setHTML(aResponse.getText());
                        nbOfErrors = 0;
                    } else {
                        myReportHTML.setHTML(constants.unableToDisplayReport());
                        nbOfErrors++;
                        GWT.log("Unable to display report (error count:" + nbOfErrors + ") "
                                + aResponse.getText(), null);
                        if (nbOfErrors >= 3) {
                            GWT.log("Disabling recurrent call after too many errors.", null);
                            myUpdateTimer.cancel();
                        }
                    }
                } else {
                    GWT.log("Skipping report result as there is still " + (myOnGoingRequests - 1)
                            + " requests in the pipe.", null);
                }
                myOnGoingRequests--;
            }
        });
        GWT.log("RPC: querying reporting", null);
        theRequestBuilder.send();
    } catch (RequestException e) {
        myReportHTML.setHTML("");
    }

}

From source file:org.bonitasoft.console.client.view.reporting.ReportParametersEditorWidget.java

License:Open Source License

protected void run() {

    if (validate()) {
        try {// ww w .  jav a 2s  . c  om
            RequestBuilder theRequestBuilder;
            final String theURL = myReportDataSource.buildReportURL(myItem, ReportScope.ADMIN);
            final String theCompleteURL = addParametersToURL(theURL);
            GWT.log("Calling the reporting engine with query: " + theCompleteURL);
            theRequestBuilder = new RequestBuilder(RequestBuilder.GET, theCompleteURL);
            theRequestBuilder.setCallback(new RequestCallback() {
                public void onError(Request aRequest, Throwable anException) {
                    myReportResultPanel.clear();
                    myReportResultPanel
                            .add(new HTML(constants.errorProcessingReport() + anException.getMessage()));
                    myDownloadLink.setHref(null);
                    myDownloadLink.setVisible(false);
                    myRefreshLink.setVisible(false);
                }

                public void onResponseReceived(Request aRequest, Response aResponse) {
                    myReportResultPanel.clear();
                    HTML theReport = new HTML();
                    theReport.setStyleName("bonita_report");
                    if (aResponse.getStatusCode() == Response.SC_OK) {
                        theReport.setHTML(aResponse.getText());
                        myDownloadLink.setHref(theCompleteURL + "&OutputFormat=pdf");
                        myDownloadLink.setVisible(true);
                        myRefreshLink.setVisible(true);
                    } else {
                        theReport.setHTML(constants.unableToDisplayReport() + "<BR/>" + aResponse.getText());
                        GWT.log("Unable to display report" + aResponse.getText(), null);
                        myDownloadLink.setHref(null);
                        myDownloadLink.setVisible(false);
                        myRefreshLink.setVisible(false);
                    }
                    myReportResultPanel.add(theReport);
                }
            });
            myReportResultPanel.clear();
            myReportResultPanel.add(new HTML(constants.loading()));
            theRequestBuilder.send();
        } catch (RequestException e) {
            Window.alert("Error while trying to query the reports:" + e.getMessage());
        }
    }
}