Example usage for javax.servlet.http Cookie getValue

List of usage examples for javax.servlet.http Cookie getValue

Introduction

In this page you can find the example usage for javax.servlet.http Cookie getValue.

Prototype

public String getValue() 

Source Link

Document

Gets the current value of this Cookie.

Usage

From source file:io.syndesis.credential.CredentialFlowStateHelper.java

static javax.ws.rs.core.Cookie toJaxRsCookie(final Cookie cookie) {
    return new javax.ws.rs.core.Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(),
            cookie.getDomain());/*from   w w w. j a v  a  2  s.c o  m*/
}

From source file:com.woonoz.proxy.servlet.CookieFormatter.java

public static CookieFormatter createFromServletCookie(javax.servlet.http.Cookie cookie) {
    return new CookieFormatter(cookie.getName(), cookie.getValue(), cookie.getPath());
}

From source file:com.mmj.app.common.cookie.parser.CookieUtils.java

/**
 * Cookie?cookie nameKeyCookie ValueValueMap
 * /*from   www . j  a v a2  s  .co m*/
 * @return cookiesnull,emptyMap
 */
public static Map<String, String> arrayToMap(Cookie[] cookies) {
    if (cookies == null || cookies.length == 0) {
        return Collections.<String, String>emptyMap();
    }
    Map<String, String> values = new HashMap<String, String>(cookies.length);
    for (Cookie cookie : cookies) {
        values.put(cookie.getName(), cookie.getValue());
    }
    return values;
}

From source file:com.eryansky.common.web.utils.RequestUtil.java

public static Cookie getCookie(HttpServletRequest request, String name) {
    Cookie[] cookies = request.getCookies();
    Cookie returnCookie = null;/*w w  w. ja  v  a2s .c o m*/

    if (cookies == null) {
        return returnCookie;
    }

    for (Cookie thisCookie : cookies) {
        if (thisCookie.getName().equals(name)) {
            if (!thisCookie.getValue().equals("")) {
                returnCookie = thisCookie;

                break;
            }
        }
    }

    return returnCookie;
}

From source file:org.apache.camel.example.gauth.TutorialController.java

private static String getCookieValue(Cookie[] cookies, String name) {
    if (cookies == null) {
        return null;
    }/*w  w w.j a  va 2s  .c  o  m*/
    for (Cookie cookie : cookies) {
        if (name.equals(cookie.getName())) {
            return cookie.getValue();
        }
    }
    return null;
}

From source file:com.openthinks.webscheduler.model.security.RememberMeCookie.java

public static RememberMeCookie valueOf(final Cookie cookie) {
    RememberMeCookie rememberMeCookie = new RememberMeCookie();
    rememberMeCookie.setToken(cookie.getValue());
    Date expireDate = DateUtils.addSeconds(new Date(), cookie.getMaxAge());
    rememberMeCookie.setExpireTime(StaticUtils.formatDate(expireDate));
    return rememberMeCookie;
}

From source file:scratch.cucumber.example.security.servlet.XAuthTokenHttpServletRequestBinder.java

private static String findToken(HttpServletRequest request) {

    final String headerToken = request.getHeader(X_AUTH_TOKEN);

    if (headerToken != null) {
        return headerToken;
    }//w  ww  . j  av a2 s.  c  o  m

    final Cookie[] cookies = request.getCookies();

    if (cookies != null) {
        for (Cookie cookie : cookies) {
            if (X_AUTH_TOKEN.equals(cookie.getName())) {
                return cookie.getValue();
            }
        }
    }

    return null;
}

From source file:com.jsmartframework.web.util.WebUtils.java

public static String getCookie(HttpServletRequest request, String name) {
    if (name == null) {
        return null;
    }// w w w  .  j  a  va 2  s .com
    Cookie[] cookies = request.getCookies();
    if (cookies == null || cookies.length == 0) {
        return null;
    }
    for (Cookie cookie : cookies) {
        if (name.equalsIgnoreCase(cookie.getName())) {
            return cookie.getValue();
        }
    }
    return null;
}

From source file:com.usefullc.platform.common.utils.CookieUtils.java

/**
 * cookie /*  www . j a  v  a 2s .c  o  m*/
 * 
 * @param request
 * @param name
 * @param domain
 * @return
 */
public static String getValue(HttpServletRequest request, String name, String domain) {
    Cookie cookie = getCookie(request, name, domain);
    if (cookie != null) {
        return cookie.getValue();
    } else {
        return null;
    }
}

From source file:com.hortonworks.example.util.Util.java

public static String getCookieValue(HttpServletRequest request, String name) {
    String value = null;//from w  w  w . j a v  a2  s.co  m
    Cookie cookie = getCookie(request, name);
    if (cookie != null) {
        value = cookie.getValue();
    }
    return value;
}