use of com.google.gwt.http.client.Response in project pentaho-platform by pentaho.
the class EmailAdminPanelController method setEmailConfig.
// -- Remote Calls.
private void setEmailConfig() {
String serviceUrl = GWT.getHostPageBaseURL() + "api/emailconfig/setEmailConfig";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, serviceUrl);
try {
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.setHeader("Content-Type", "application/json");
executableTypesRequestBuilder.sendRequest(emailConfig.getJSONString(), new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
setDirty(false);
}
});
} catch (RequestException e) {
// ignored
}
}
use of com.google.gwt.http.client.Response in project pentaho-platform by pentaho.
the class UserDialog method performSave.
private void performSave() throws RequestException {
String url = GWT.getHostPageBaseURL() + "api/repo/files/reservedCharacters";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
requestBuilder.sendRequest("", new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
String userName = nameTextBox.getText();
String password = passwordTextBox.getText();
String reservedCharacters = response.getText();
if (isValidName(userName, reservedCharacters)) {
controller.saveUser(userName, password);
hide();
} else {
showErrorMessage(userName, reservedCharacters);
}
}
@Override
public void onError(Request request, Throwable exception) {
hide();
}
});
}
use of com.google.gwt.http.client.Response in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method deleteRoles.
public void deleteRoles() {
StringBuilder selectedRoles = new StringBuilder();
for (int i = 0; i < rolesListBox.getItemCount(); i++) {
if (rolesListBox.isItemSelected(i)) {
selectedRoles.append(encodeUri(rolesListBox.getValue(i) + delimiter));
}
}
String serviceUrl = GWT.getHostPageBaseURL() + "api/userroledao/deleteRoles?roleNames=" + selectedRoles.toString();
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, serviceUrl);
try {
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
displayErrorInMessageBox(Messages.getString("Error"), exception.getLocalizedMessage());
}
public void onResponseReceived(Request request, Response response) {
checkForError(Messages.getString("Error"), response);
availableMembersListBox.clear();
selectedMembersListBox.clear();
updateHelperDiv(HorizontalScrollWrapper.getListBoxWrapperUIId(availableMembersListBox));
updateHelperDiv(HorizontalScrollWrapper.getListBoxWrapperUIId(selectedMembersListBox));
initializeRoles(null, "api/userroledao/roles", rolesListBox);
initializeAvailableUsers(usersListBox.getValue(usersListBox.getSelectedIndex()));
}
});
} catch (RequestException e) {
displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
}
}
use of com.google.gwt.http.client.Response in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method activate.
// -- ISysAdminPanel implementation.
public void activate() {
processLDAPOrJDBCmode();
initializeActionBaseSecurityElements();
initializeAvailableUsers(null);
final String url = GWT.getHostPageBaseURL() + "api/system/authentication-provider";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.setHeader("accept", "application/json");
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
boolean usingPentahoSecurity = response.getText().contains("jackrabbit");
if (!usingPentahoSecurity) {
initializeRoles(null, "api/userrolelist/roles?addExtraRoles=false", rolesListBox);
} else {
initializeRoles(null, "api/userroledao/roles", rolesListBox);
}
initializeRoles(null, "api/userrolelist/extraRoles", systemRolesListBox);
}
});
} catch (RequestException e) {
// ignored
}
}
use of com.google.gwt.http.client.Response in project pentaho-platform by pentaho.
the class UserRolesAdminPanelController method saveRole.
public void saveRole(final String name) {
String serviceUrl = GWT.getHostPageBaseURL() + "api/userroledao/createRole?roleName=" + encodeUri(name);
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, serviceUrl);
try {
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
displayErrorInMessageBox(Messages.getString("Error"), exception.getLocalizedMessage());
}
public void onResponseReceived(Request request, Response response) {
initializeRoles(name, "api/userroledao/roles", rolesListBox);
initializeAvailableUsers(usersListBox.getValue(usersListBox.getSelectedIndex()));
}
});
} catch (RequestException e) {
displayErrorInMessageBox(Messages.getString("Error"), e.getLocalizedMessage());
}
}
Aggregations