use of org.pentaho.mantle.client.csrf.CsrfRequestBuilder in project pentaho-platform by pentaho.
the class ExecuteGlobalActionsCommand method performOperation.
protected void performOperation() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/system/refresh/globalActions";
RequestBuilder requestBuilder = new CsrfRequestBuilder(RequestBuilder.GET, url);
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
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"), Messages.getString("globalActionsExecutedSuccessfully"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
use of org.pentaho.mantle.client.csrf.CsrfRequestBuilder in project pentaho-platform by pentaho.
the class AbstractFilePickList method save.
/**
* Convert the FilePickList to JSON and save it to a user setting
*
* @param settingName
*/
public void save(String settingName) {
String url = GWT.getHostPageBaseURL() + "api/user-settings/" + settingName;
RequestBuilder builder = new CsrfRequestBuilder(RequestBuilder.POST, url);
try {
builder.setHeader("accept", "application/json");
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest(toJson().toString(), new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialog = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotSetUserSettings"), true, false, true);
dialog.center();
}
public void onResponseReceived(Request request, Response response) {
fireOnSavedEvent();
}
});
} catch (RequestException e) {
// showError(e);
}
}
use of org.pentaho.mantle.client.csrf.CsrfRequestBuilder in project pentaho-platform by pentaho.
the class RefreshSystemSettingsCommand method performOperation.
protected void performOperation() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/system/refresh/systemSettings";
RequestBuilder requestBuilder = new CsrfRequestBuilder(RequestBuilder.GET, url);
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
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"), Messages.getString("refreshSystemSettingsSuccess"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
use of org.pentaho.mantle.client.csrf.CsrfRequestBuilder in project pentaho-platform by pentaho.
the class ShowBrowserCommand method execute.
public void execute() {
final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
solutionBrowserPerspective.setNavigatorShowing(state);
if (PerspectiveManager.getInstance().getActivePerspective().getId().equalsIgnoreCase(PerspectiveManager.OPENED_PERSPECTIVE)) {
PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
}
String url = GWT.getHostPageBaseURL() + "api/user-settings/MANTLE_SHOW_NAVIGATOR";
RequestBuilder builder = new CsrfRequestBuilder(RequestBuilder.POST, url);
try {
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest("" + state, EmptyRequestCallback.getInstance());
} catch (RequestException e) {
// showError(e);
}
}
use of org.pentaho.mantle.client.csrf.CsrfRequestBuilder in project pentaho-platform by pentaho.
the class SwitchThemeCommand method performOperation.
protected void performOperation(boolean feedback) {
final HTML messageTextBox = new HTML(Messages.getString("confirmSwitchTheme.message"));
final PromptDialogBox fileMoveToTrashWarningDialogBox = new PromptDialogBox(Messages.getString("confirmSwitchTheme.title"), Messages.getString("confirmSwitchTheme.ok"), Messages.getString("confirmSwitchTheme.cancel"), true, true);
fileMoveToTrashWarningDialogBox.setContent(messageTextBox);
final IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
}
public void okPressed() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/theme/set";
RequestBuilder setThemeRequestBuilder = new CsrfRequestBuilder(RequestBuilder.POST, url);
setThemeRequestBuilder.setHeader("accept", "text/plain");
setThemeRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
setThemeRequestBuilder.sendRequest(theme, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
// forcing a setTimeout to fix a problem in IE BISERVER-6385
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
Window.Location.reload();
}
});
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
};
fileMoveToTrashWarningDialogBox.setCallback(callback);
fileMoveToTrashWarningDialogBox.center();
}
Aggregations