Search in sources :

Example 91 with Response

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
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 92 with Response

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();
        }
    });
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request)

Example 93 with Response

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());
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 94 with Response

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
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Example 95 with Response

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());
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

Response (com.google.gwt.http.client.Response)168 Request (com.google.gwt.http.client.Request)166 RequestCallback (com.google.gwt.http.client.RequestCallback)165 RequestException (com.google.gwt.http.client.RequestException)158 RequestBuilder (com.google.gwt.http.client.RequestBuilder)108 JSONException (com.google.gwt.json.client.JSONException)55 HttpException (com.willshex.gson.web.service.client.HttpException)55 MessageDialogBox (org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)17 BlockUsersRequest (com.willshex.blogwt.shared.api.user.call.BlockUsersRequest)12 BlockUsersResponse (com.willshex.blogwt.shared.api.user.call.BlockUsersResponse)12 ChangePasswordRequest (com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest)12 ChangePasswordResponse (com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse)12 ChangeUserAccessRequest (com.willshex.blogwt.shared.api.user.call.ChangeUserAccessRequest)12 ChangeUserAccessResponse (com.willshex.blogwt.shared.api.user.call.ChangeUserAccessResponse)12 ChangeUserDetailsRequest (com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsRequest)12 ChangeUserDetailsResponse (com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsResponse)12 CheckUsernameRequest (com.willshex.blogwt.shared.api.user.call.CheckUsernameRequest)12 CheckUsernameResponse (com.willshex.blogwt.shared.api.user.call.CheckUsernameResponse)12 FollowUsersRequest (com.willshex.blogwt.shared.api.user.call.FollowUsersRequest)12 FollowUsersResponse (com.willshex.blogwt.shared.api.user.call.FollowUsersResponse)12