Search in sources :

Example 1 with FormElement

use of com.google.gwt.dom.client.FormElement in project rstudio by rstudio.

the class Application method onLogoutRequested.

public void onLogoutRequested(LogoutRequestedEvent event) {
    cleanupWorkbench();
    // create an invisible form to host the sign-out process
    FormElement form = DocumentEx.get().createFormElement();
    form.setMethod("POST");
    form.setAction(absoluteUrl("auth-sign-out", true));
    form.getStyle().setDisplay(Display.NONE);
    // read the CSRF token from the cookie and place it in the form
    InputElement csrfToken = DocumentEx.get().createHiddenInputElement();
    csrfToken.setName(CSRF_TOKEN_FIELD);
    csrfToken.setValue(Cookies.getCookie(CSRF_TOKEN_FIELD));
    form.appendChild(csrfToken);
    // append the form to the document and submit it
    DocumentEx.get().getBody().appendChild(form);
    form.submit();
}
Also used : InputElement(com.google.gwt.dom.client.InputElement) FormElement(com.google.gwt.dom.client.FormElement)

Aggregations

FormElement (com.google.gwt.dom.client.FormElement)1 InputElement (com.google.gwt.dom.client.InputElement)1