Example usage for com.vaadin.server VaadinRequest getCookies

List of usage examples for com.vaadin.server VaadinRequest getCookies

Introduction

In this page you can find the example usage for com.vaadin.server VaadinRequest getCookies.

Prototype

public Cookie[] getCookies();

Source Link

Document

Returns an array containing all of the Cookie objects the client sent with this request.

Usage

From source file:de.metas.procurement.webui.service.impl.LoginRememberMeService.java

License:Open Source License

private Cookie getRememberMeCookie() {
    final VaadinRequest vaadinRequest = VaadinService.getCurrentRequest();
    if (vaadinRequest == null) {
        logger.warn(/*from w w  w.  j a va 2  s  . c  o m*/
                "Could not get the VaadinRequest. It might be that we are called from a websocket connection.");
        return null;
    }

    //
    // Get the remember me cookie
    final Cookie[] cookies = vaadinRequest.getCookies();
    if (cookies == null) {
        return null;
    }

    for (final Cookie cookie : cookies) {
        if (COOKIENAME_RememberMe.equals(cookie.getName())) {
            return cookie;
        }
    }

    return null;
}

From source file:edu.nps.moves.mmowgli.MmowgliSessionGlobals.java

License:Open Source License

public String getVaadinSessionCookie() {
    if (sessionCookie == null) { // try once
        VaadinRequest req = VaadinService.getCurrentRequest();
        if (req != null)
            sessionCookie = getCookie(req.getCookies());
    }/*  w  w w.ja va 2 s. c  om*/
    return (sessionCookie == null ? "null" : sessionCookie.getValue());
}