Example usage for com.google.gwt.user.client.rpc XsrfTokenServiceAsync getNewXsrfToken

List of usage examples for com.google.gwt.user.client.rpc XsrfTokenServiceAsync getNewXsrfToken

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc XsrfTokenServiceAsync getNewXsrfToken.

Prototype

void getNewXsrfToken(AsyncCallback<XsrfToken> asyncCallback);

Source Link

Usage

From source file:net.webpasswordsafe.client.WebPasswordSafe.java

License:Open Source License

private void initXsrfProtection(final LoginWindow loginWindow) {
    XsrfTokenServiceAsync xsrf = (XsrfTokenServiceAsync) GWT.create(XsrfTokenService.class);
    ((ServiceDefTarget) xsrf).setServiceEntryPoint(GWT.getModuleBaseURL() + "xsrf");
    xsrf.getNewXsrfToken(new AsyncCallback<XsrfToken>() {
        @Override/*from  ww w .  j a va2  s  .  c  o m*/
        public void onSuccess(XsrfToken token) {
            ServiceHelper.setXsrfToken(token);
            getSystemSettings(loginWindow);
        }

        @Override
        public void onFailure(Throwable caught) {
            WebPasswordSafe.handleServerFailure(caught);
        }
    });
}