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.pentaho.mantle.client.commands.AbstractFilePropertiesCommand.java

License:Open Source License

public void performOperation() {

    final SolutionFileActionEvent event = new SolutionFileActionEvent();
    event.setAction(this.getClass().getName());

    if (getRepositoryFile() != null) {
        final RepositoryFile item = getRepositoryFile();

        // Checking if the user has access to manage permissions
        String url = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(item.getPath())
                + "/canAccess?permissions=" + MANAGE_ACLS; //$NON-NLS-1$ //$NON-NLS-2$
        RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
        try {/*from  w  ww .j  a v  a2  s.  c  o m*/
            builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
            builder.sendRequest(null, new RequestCallback() {

                public void onError(Request request, Throwable exception) {
                    FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null,
                            getActiveTab(), false);
                    dialog.showTab(getActiveTab());
                    dialog.center();

                    event.setMessage(exception.getMessage());
                    EventBusUtil.EVENT_BUS.fireEvent(event);
                }

                public void onResponseReceived(Request request, Response response) {
                    FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null,
                            getActiveTab(), Boolean.parseBoolean(response.getText()));
                    dialog.showTab(getActiveTab());
                    dialog.center();

                    event.setMessage("Success");
                    EventBusUtil.EVENT_BUS.fireEvent(event);
                }
            });
        } catch (RequestException e) {
            FilePropertiesDialog dialog = new FilePropertiesDialog(item, new PentahoTabPanel(), null,
                    getActiveTab(), false);
            dialog.showTab(getActiveTab());
            dialog.center();

            event.setMessage(e.getMessage());
            EventBusUtil.EVENT_BUS.fireEvent(event);
        }
    }
}

From source file:org.pentaho.mantle.client.commands.AdhocRunInBackgroundCommand.java

License:Open Source License

private RequestBuilder createTreeRequest() {
    RequestBuilder scheduleFileRequestBuilder = new RequestBuilder(RequestBuilder.GET, contextURL
            + "api/repo/files/" + NameUtils.encodeRepositoryPath(getOutputLocationPath()) + "/tree?depth=1");
    scheduleFileRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    return scheduleFileRequestBuilder;
}

From source file:org.pentaho.mantle.client.commands.CheckForSoftwareUpdatesCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    final String url = GWT.getHostPageBaseURL() + "api/version/softwareUpdates"; //$NON-NLS-1$
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    requestBuilder.setHeader("accept", "text/plain");
    try {/*from   w  ww  .  j a  v a 2 s . co m*/
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("softwareUpdates"), //$NON-NLS-1$
                        Messages.getString("noUpdatesAvailable"), false, false, true); //$NON-NLS-1$
                dialogBox.center();
            }

            public void onResponseReceived(Request request, Response response) {
                Document doc = XMLParser.parse(response.getText());
                NodeList updates = doc.getElementsByTagName("update"); //$NON-NLS-1$
                if (updates.getLength() > 0) {
                    FlexTable updateTable = new FlexTable();
                    updateTable.setStyleName("backgroundContentTable"); //$NON-NLS-1$
                    updateTable.setWidget(0, 0, new Label(Messages.getString("version"))); //$NON-NLS-1$
                    updateTable.setWidget(0, 1, new Label(Messages.getString("type"))); //$NON-NLS-1$
                    updateTable.setWidget(0, 2, new Label(Messages.getString("os"))); //$NON-NLS-1$
                    updateTable.setWidget(0, 3, new Label(Messages.getString("link"))); //$NON-NLS-1$
                    updateTable.getCellFormatter().setStyleName(0, 0, "backgroundContentHeaderTableCell"); //$NON-NLS-1$
                    updateTable.getCellFormatter().setStyleName(0, 1, "backgroundContentHeaderTableCell"); //$NON-NLS-1$
                    updateTable.getCellFormatter().setStyleName(0, 2, "backgroundContentHeaderTableCell"); //$NON-NLS-1$
                    updateTable.getCellFormatter().setStyleName(0, 3, "backgroundContentHeaderTableCellRight"); //$NON-NLS-1$

                    for (int i = 0; i < updates.getLength(); i++) {
                        Element updateElement = (Element) updates.item(i);
                        String version = updateElement.getAttribute("version"); //$NON-NLS-1$
                        String type = updateElement.getAttribute("type"); //$NON-NLS-1$
                        String os = updateElement.getAttribute("os"); //$NON-NLS-1$
                        // String title = updateElement.getAttribute("title");
                        String downloadURL = updateElement.getElementsByTagName("downloadurl").item(0) //$NON-NLS-1$
                                .toString();
                        downloadURL = downloadURL.substring(downloadURL.indexOf("http"), //$NON-NLS-1$
                                downloadURL.indexOf("]")); //$NON-NLS-1$
                        updateTable.setWidget(i + 1, 0, new Label(version));
                        updateTable.setWidget(i + 1, 1, new Label(type));
                        updateTable.setWidget(i + 1, 2, new Label(os));
                        updateTable.setWidget(i + 1, 3,
                                new HTML("<A HREF=\"" + downloadURL + "\" target=\"_blank\" title=\""
                                        + downloadURL + "\">" + Messages.getString("download") + "</A>")); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                        updateTable.getCellFormatter().setStyleName(i + 1, 0, "backgroundContentTableCell"); //$NON-NLS-1$
                        updateTable.getCellFormatter().setStyleName(i + 1, 1, "backgroundContentTableCell"); //$NON-NLS-1$
                        updateTable.getCellFormatter().setStyleName(i + 1, 2, "backgroundContentTableCell"); //$NON-NLS-1$
                        updateTable.getCellFormatter().setStyleName(i + 1, 3,
                                "backgroundContentTableCellRight"); //$NON-NLS-1$
                        if (i == updates.getLength() - 1) {
                            // last
                            updateTable.getCellFormatter().setStyleName(i + 1, 0,
                                    "backgroundContentTableCellBottom"); //$NON-NLS-1$
                            updateTable.getCellFormatter().setStyleName(i + 1, 1,
                                    "backgroundContentTableCellBottom"); //$NON-NLS-1$
                            updateTable.getCellFormatter().setStyleName(i + 1, 2,
                                    "backgroundContentTableCellBottom"); //$NON-NLS-1$
                            updateTable.getCellFormatter().setStyleName(i + 1, 3,
                                    "backgroundContentTableCellBottomRight"); //$NON-NLS-1$
                        }
                    }
                    PromptDialogBox versionPromptDialog = new PromptDialogBox(
                            Messages.getString("softwareUpdateAvailable"), Messages.getString("ok"), null, //$NON-NLS-1$//$NON-NLS-2$
                            false, true, updateTable);
                    versionPromptDialog.center();
                } else {
                    MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("softwareUpdates"), //$NON-NLS-1$
                            Messages.getString("noUpdatesAvailable"), false, false, true); //$NON-NLS-1$
                    dialogBox.center();
                }
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
        // showError(e);
    }
}

From source file:org.pentaho.mantle.client.commands.ExecuteGlobalActionsCommand.java

License:Open Source License

protected void performOperation() {
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/globalActions"; //$NON-NLS-1$
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    requestBuilder.setHeader("accept", "text/plain");
    requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    try {/*from   www.  ja v  a 2s . com*/
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                // showError(exception);
            }

            public void onResponseReceived(Request request, Response response) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$
                        Messages.getString("globalActionsExecutedSuccessfully"), false, false, true); //$NON-NLS-1$
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
        // showError(e);
    }
}

From source file:org.pentaho.mantle.client.commands.NewDropdownCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    final PopupPanel popup = new PopupPanel(true, false) {
        public void show() {
            // show glass pane
            super.show();
            if (pageBackground == null) {
                pageBackground = new FocusPanel() {
                    public void onBrowserEvent(Event event) {
                        int type = event.getTypeInt();
                        switch (type) {
                        case Event.ONKEYDOWN: {
                            if ((char) event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
                                event.stopPropagation();
                                hide();/* w w  w. j  av a2  s  .c o m*/
                            }
                            return;
                        }
                        }
                        super.onBrowserEvent(event);
                    };
                };
                pageBackground.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        hide();
                        pageBackground.setVisible(false);
                        pageBackground.getElement().getStyle().setDisplay(Display.NONE);
                    }
                });
                RootPanel.get().add(pageBackground, 0, 0);
            }
            pageBackground.setSize("100%", Window.getClientHeight() + Window.getScrollTop() + "px"); //$NON-NLS-1$ //$NON-NLS-2$
            pageBackground.setVisible(true);
            pageBackground.getElement().getStyle().setDisplay(Display.BLOCK);

            // hide <embeds>
            // TODO: migrate to GlassPane Listener
            FrameUtils.toggleEmbedVisibility(false);

            // Notify listeners that we're showing a dialog (hide PDFs, flash).
            GlassPane.getInstance().show();
        }

        public void hide(boolean autoClosed) {
            super.hide(autoClosed);
            pageBackground.setVisible(false);
            GlassPane.getInstance().hide();
        }

        protected void onPreviewNativeEvent(final NativePreviewEvent event) {
            // Switch on the event type
            int type = event.getTypeInt();
            switch (type) {
            case Event.ONKEYDOWN: {
                Event nativeEvent = Event.as(event.getNativeEvent());
                if ((char) nativeEvent.getKeyCode() == KeyCodes.KEY_ESCAPE) {
                    event.cancel();
                    hide();
                }
                return;
            }
            }
        };
    };

    if (popup.isShowing()) {
        popup.hide();
        return;
    }

    String url = GWT.getHostPageBaseURL() + "api/plugin-manager/settings/new-toolbar-button"; //$NON-NLS-1$
    RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
    rb.setHeader("Content-Type", "text/plain"); //$NON-NLS-1$//$NON-NLS-2$
    rb.setHeader("accept", "application/json"); //$NON-NLS-1$//$NON-NLS-2$
    rb.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    try {
        rb.sendRequest(null, new RequestCallback() {

            @Override
            public void onError(Request request, Throwable exception) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$
                        exception.getMessage(), //$NON-NLS-2$
                        false, false, true);
                dialogBox.center();
            }

            @Override
            public void onResponseReceived(Request request, Response response) {
                if (response.getStatusCode() == 200) {
                    JsArray<JsCreateNewConfig> jsarray = parseJson(
                            JsonUtils.escapeJsonForEval(response.getText()));
                    final ArrayList<JsCreateNewConfig> sorted = new ArrayList<JsCreateNewConfig>();
                    for (int i = 0; i < jsarray.length(); i++) {
                        sorted.add(jsarray.get(i));
                    }
                    Collections.sort(sorted, new JsCreateNewConfigComparator());
                    popup.setStyleName("newToolbarDropdown");
                    VerticalPanel buttonPanel = new VerticalPanel();
                    popup.add(buttonPanel);
                    for (int i = 0; i < sorted.size(); i++) {
                        final int finali = i;
                        String enabledUrl = sorted.get(i).getEnabledUrl();
                        if (buttonEnabled(enabledUrl)) {
                            Button button = new Button(Messages.getString(sorted.get(i).getLabel()));
                            button.setStyleName("pentaho-button");
                            button.getElement().addClassName("newToolbarDropdownButton");
                            button.addClickHandler(new ClickHandler() {
                                public void onClick(ClickEvent event) {
                                    if (sorted.get(finali).getActionUrl().startsWith("javascript:")) {
                                        doEvalJS(sorted.get(finali).getActionUrl()
                                                .substring("javascript:".length()));
                                    } else {
                                        SolutionBrowserPanel.getInstance().getContentTabPanel().showNewURLTab(
                                                Messages.getString(sorted.get(finali).getTabName()),
                                                Messages.getString(sorted.get(finali).getTabName()),
                                                sorted.get(finali).getActionUrl(), false);
                                    }
                                    popup.hide();
                                }
                            });
                            String name = sorted.get(i).getName();
                            if ("data-access".equals(name)) {
                                buttonPanel.add(new HTML("<hr style='color: #a7a7a7' />"));
                            }
                            buttonPanel.add(button);
                        }
                    }
                    popup.setPopupPosition(anchorWidget.getAbsoluteLeft(),
                            anchorWidget.getAbsoluteTop() + anchorWidget.getOffsetHeight());
                    popup.show();
                } else {
                    MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$
                            Messages.getString("error"), //$NON-NLS-1$
                            false, false, true);
                    dialogBox.center();
                }
            }

            private boolean buttonEnabled(String enabledUrl) {
                if (enabledUrl == null || enabledUrl.isEmpty()) {
                    return true;
                } else {
                    Boolean enabled = false;
                    try {
                        enabled = Boolean.valueOf(sendRequest(enabledUrl));
                    } catch (Exception e) {
                    }
                    return enabled;
                }
            }

        });
    } catch (RequestException e) {
        MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), e.getMessage(), //$NON-NLS-1$ //$NON-NLS-2$
                false, false, true);
        dialogBox.center();
    }

}

From source file:org.pentaho.mantle.client.commands.NewRootFolderCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    final TextBox folderNameTextBox = new TextBox();
    folderNameTextBox.setTabIndex(1);/*from w  ww .j  av a2  s  . com*/
    folderNameTextBox.setVisibleLength(40);

    VerticalPanel vp = new VerticalPanel();
    vp.add(new Label(Messages.getString("newFolderName"))); //$NON-NLS-1$
    vp.add(folderNameTextBox);
    final PromptDialogBox newFolderDialog = new PromptDialogBox(Messages.getString("newFolder"), //$NON-NLS-1$
            Messages.getString("ok"), Messages.getString("cancel"), false, true, vp); //$NON-NLS-1$ //$NON-NLS-2$
    newFolderDialog.setFocusWidget(folderNameTextBox);
    folderNameTextBox.setFocus(true);

    final IDialogCallback callback = new IDialogCallback() {

        public void cancelPressed() {
            newFolderDialog.hide();
        }

        public void okPressed() {
            String url = ""; //$NON-NLS-1$
            if (GWT.isScript()) {
                String windowpath = Window.Location.getPath();
                if (!windowpath.endsWith("/")) { //$NON-NLS-1$
                    windowpath = windowpath.substring(0, windowpath.lastIndexOf("/") + 1); //$NON-NLS-1$
                }
                url = windowpath + "SolutionRepositoryService?component=createNewFolder&solution=" + solution //$NON-NLS-1$
                        + "&path=" + repoPath + "&name=" //$NON-NLS-1$ //$NON-NLS-2$
                        + folderNameTextBox.getText(); //$NON-NLS-1$
            } else if (!GWT.isScript()) {
                url = "http://localhost:8080/pentaho/SolutionRepositoryService?component=createNewFolder&solution=" //$NON-NLS-1$
                        + solution + "&path=" //$NON-NLS-1$
                        + repoPath + "&name=" + folderNameTextBox.getText(); //$NON-NLS-1$ //$NON-NLS-2$
            }
            final String myurl = url;
            RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, myurl);
            try {
                builder.sendRequest(null, new RequestCallback() {

                    public void onError(Request request, Throwable exception) {
                        MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$
                                Messages.getString("couldNotCreateFolder", folderNameTextBox.getText()), //$NON-NLS-1$
                                false, false, true);
                        dialogBox.center();
                    }

                    public void onResponseReceived(Request request, Response response) {
                        Document resultDoc = (Document) XMLParser.parse((String) (String) response.getText());
                        boolean result = "true" //$NON-NLS-1$
                                .equals(resultDoc.getDocumentElement().getFirstChild().getNodeValue());
                        if (result) {
                            RefreshRepositoryCommand cmd = new RefreshRepositoryCommand();
                            cmd.execute(false);
                        } else {
                            MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$
                                    Messages.getString("couldNotCreateFolder", folderNameTextBox.getText()), //$NON-NLS-1$
                                    false, false, true);
                            dialogBox.center();
                        }
                    }

                });
            } catch (RequestException e) {
            }
        }
    };
    newFolderDialog.setCallback(callback);
    newFolderDialog.center();
}

From source file:org.pentaho.mantle.client.commands.PasteFilesCommand.java

License:Open Source License

@Override
protected void performOperation(boolean feedback) {
    final SolutionBrowserClipboard clipBoard = SolutionBrowserClipboard.getInstance();
    @SuppressWarnings("unchecked")
    final List<SolutionBrowserFile> clipboardFileItems = clipBoard.getClipboardItems();

    if (clipboardFileItems != null && clipboardFileItems.size() > 0 && getSolutionPath() != null) {
        String getChildrenUrl = contextURL + "api/repo/files/"
                + SolutionBrowserPanel.pathToId(getSolutionPath()) + "/tree?depth=1" + "&showHidden=" //$NON-NLS-2$
                + SolutionBrowserPanel.getInstance().getSolutionTree().isShowHiddenFiles(); //$NON-NLS-2$
        RequestBuilder childrenRequestBuilder = new RequestBuilder(RequestBuilder.GET, getChildrenUrl);
        try {//from   w ww.j  av  a  2  s .  c o m
            childrenRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
            childrenRequestBuilder.sendRequest(null, new RequestCallback() {

                @Override
                public void onError(Request getChildrenRequest, Throwable exception) {
                    Window.alert(exception.getLocalizedMessage());
                    event.setMessage(exception.getLocalizedMessage());
                    EventBusUtil.EVENT_BUS.fireEvent(event);
                }

                @Override
                public void onResponseReceived(Request getChildrenRequest, Response getChildrenResponse) {
                    event.setMessage("Click");
                    EventBusUtil.EVENT_BUS.fireEvent(event);
                    boolean cutSameDir = false;
                    if (getChildrenResponse.getStatusCode() >= 200
                            && getChildrenResponse.getStatusCode() < 300) {
                        boolean promptForOptions = false;
                        Document children = XMLParser.parse(getChildrenResponse.getText());
                        NodeList childrenNameNodes = children.getElementsByTagName(NAME_NODE_TAG);
                        List<String> childNames = new ArrayList<String>();
                        for (int i = 0; i < childrenNameNodes.getLength(); i++) {
                            Node childNameNode = childrenNameNodes.item(i);
                            childNames.add(childNameNode.getFirstChild().getNodeValue());
                        }

                        for (SolutionBrowserFile file : clipboardFileItems) {
                            if (file.getPath() != null) {
                                String pasteFileParentPath = file.getPath();
                                String fileNameWithExt = pasteFileParentPath.substring(
                                        pasteFileParentPath.lastIndexOf("/") + 1, pasteFileParentPath.length()); //$NON-NLS-1$
                                pasteFileParentPath = pasteFileParentPath.substring(0,
                                        pasteFileParentPath.lastIndexOf("/")); //$NON-NLS-1$
                                if (childNames.contains(fileNameWithExt)
                                        && !getSolutionPath().equals(pasteFileParentPath)) {
                                    promptForOptions = true;
                                    break;
                                } else if (childNames.contains(fileNameWithExt)
                                        && getSolutionPath().equals(pasteFileParentPath)
                                        && SolutionBrowserClipboard.getInstance()
                                                .getClipboardAction() == SolutionBrowserClipboard.ClipboardAction.CUT) {
                                    cutSameDir = true;
                                    break;
                                }
                            }
                        }
                        if (promptForOptions) {
                            final OverwritePromptDialog overwriteDialog = new OverwritePromptDialog();
                            final IDialogCallback callback = new IDialogCallback() {
                                public void cancelPressed() {
                                    event.setMessage("Cancel");
                                    EventBusUtil.EVENT_BUS.fireEvent(event);
                                    overwriteDialog.hide();
                                }

                                public void okPressed() {
                                    performSave(clipBoard, overwriteDialog.getOverwriteMode());
                                }
                            };
                            overwriteDialog.setCallback(callback);
                            overwriteDialog.center();
                        } else {
                            if (!cutSameDir) {
                                performSave(clipBoard, 2);
                            } else {
                                event.setMessage("Cancel");
                                EventBusUtil.EVENT_BUS.fireEvent(event);
                            }
                        }
                    } else {
                        Window.alert(getChildrenResponse.getText());
                    }
                }

            });
        } catch (RequestException e) {
            Window.alert(e.getLocalizedMessage());
        }
    }
}

From source file:org.pentaho.mantle.client.commands.PurgeMondrianSchemaCacheCommand.java

License:Open Source License

protected void performOperation() {
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/mondrianSchemaCache"; //$NON-NLS-1$
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    requestBuilder.setHeader("accept", "text/plain");
    try {//ww w.  j av a  2  s .co  m
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                // showError(exception);
            }

            public void onResponseReceived(Request request, Response response) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$
                        Messages.getString("mondrianSchemaCacheFlushedSuccessfully"), false, false, true); //$NON-NLS-1$
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
        // showError(e);
    }
}

From source file:org.pentaho.mantle.client.commands.PurgeReportingDataCacheCommand.java

License:Open Source License

protected void performOperation() {
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/reportingDataCache"; //$NON-NLS-1$
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    requestBuilder.setHeader("accept", "text/plain");
    requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    try {//from  w  w w. j  a v  a 2 s .  c o m
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                // showError(exception);
            }

            public void onResponseReceived(Request request, Response response) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$
                        Messages.getString("reportingDataCacheFlushedSuccessfully"), false, false, true); //$NON-NLS-1$
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
        // showError(e);
    }
}

From source file:org.pentaho.mantle.client.commands.RefreshMetaDataCommand.java

License:Open Source License

protected void performOperation() {
    final String url = GWT.getHostPageBaseURL() + "api/system/refresh/metadata"; //$NON-NLS-1$
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
    requestBuilder.setHeader("accept", "text/plain");
    requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
    try {//w ww.j  a  v a  2s.c  om
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable exception) {
                // showError(exception);
            }

            public void onResponseReceived(Request request, Response response) {
                MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$
                        response.getText(), true, false, true);
                dialogBox.center();
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
        // showError(e);
    }
}