Find the value of a cookie on the request, by name.
@param request The request on which to check for the cookie.
@param name The name of the cookie we want the value of.
@return The value of the cookie, if present, otherwise null.
356152
public static String extractCookie(final HttpServletRequest request, final String name) {
		for (Cookie cookie : request.getCookies()) {
			if (cookie.getName().equals(name)) {
				return cookie.getValue();
			}
		}
		return null;
	}
938966
public static Map<String, String> createCookiesMap(HttpServletRequest request) {
        Map<String, String> cookiesMap = new HashMap<String, String>();
        Cookie[] cookies = request.getCookies();

        if (ArrayUtils.isNotEmpty(cookies)) {
            for (Cookie cookie : request.getCookies()) {
                cookiesMap.put(cookie.getName(), cookie.getValue());
            }
        }

        return cookiesMap;
    }
623420
public static void setCookie(String name, String value, int maxAge, HttpServletRequest request, HttpServletResponse response) {
		boolean httpOnly = false;
		CookieUtil.setCookie(name, value, maxAge, httpOnly, request, response);
	}
783495
protected String getWarnMessageFromCookie(final HttpServletRequest request) {
    final Cookie cookie = getCookieByName(request, AZKABAN_WARN_MESSAGE);

    if (cookie == null) {
      return null;
    }
    return cookie.getValue();
  }
129526
public static String getCookieUsername(HttpServletRequest request) {
		String username = CookieUtil.getCookie("username", request);
		try {
			username = URLDecoder.decode(username, "UTF-8");
		}
		catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e.getMessage(), e);
		}
		return username;
	}
1236779
public Cookie get(String name, String domain) {
		for(Cookie cookie : this) {
			if(cookie.getName().equals(name) && cookie.getDomain().equals(domain))
				return cookie; 
		}
		return null;
	}
1295632
public static Cookie getCookie (HttpServletRequest req, String name)
    {
        Cookie[] cookies = req.getCookies();
        if (cookies != null) {
            for (int ii=0, nn=cookies.length; ii < nn; ii++) {
                if (cookies[ii].getName().equals(name)) {
                    return cookies[ii];
                }
            }
        }

        return null; // not found
    }
855596
public static Cookie getCookie(String name, HttpServletRequest request) {
        Cookie[] cookies = request.getCookies();
        if (ArrayUtils.isNotEmpty(cookies)) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals(name)) {
                    return cookie;
                }
            }
        }

        return null;
    }
674257
public static void deleteCookie(String name, HttpServletRequest request, HttpServletResponse response) {
		if (name == null || name.length() == 0) {
			throw new IllegalArgumentException("cookie名称不能为空.");
		}
		CookieUtil.setCookie(name, "", -1, false, request, response);
	}
298069
public static void setCookieValue(CmsJspActionElement jsp, String name, String value) {

        Cookie[] cookies = jsp.getRequest().getCookies();
        for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
            if (name.equalsIgnoreCase(cookies[i].getName())) {
                cookies[i].setValue(value);
                return;
            }
        }
        Cookie cookie = new Cookie(name, value);
        jsp.getResponse().addCookie(cookie);
    }
455662
function(name) {
		var cookie = document.cookie, e, p = name + "=", b;

		if ( !cookie )
			return;

		b = cookie.indexOf("; " + p);

		if ( b == -1 ) {
			b = cookie.indexOf(p);

			if ( b != 0 )
				return null;

		} else {
			b += 2;
		}

		e = cookie.indexOf(";", b);

		if ( e == -1 )
			e = cookie.length;

		return decodeURIComponent( cookie.substring(b + p.length, e) );
	}
103766
public static String getParameter(final HttpServletRequest request, final String name) {
		String value = request.getParameter(name);
		if (value == null) {
			return "";
		}
		return value;
	}
810736
public final static Cookie getCookie(HttpServletRequest httpServletRequest, String name) {
		final Map<String, Cookie> cookieMap = readCookieMap(httpServletRequest);
		return cookieMap == null ? null : cookieMap.get(name);
	}
1018204
@Override
  public final String getCookieValue(final String pName) {
    if (this.httpReq.getCookies() == null) {
      return null;
    }
    for (Cookie co : this.httpReq.getCookies()) {
      if (co.getName().equals(pName)) {
        return co.getValue();
      }
    }
    return null;
  }
947571
public static boolean addCookie(HttpServletResponse response, String name, String value) {
        return addCookie(new Cookie(name, value), response);
    }
108615
public String getCookieValue(String name) {
		HttpCookie cookie = getCookie(name);
		return (null == cookie) ? null : cookie.getValue();
	}
301926
public int getAllCookieValues(String name, List<String> list) {
        int added = 0;
        if (0 < this.parsedList.size() && null != name) {
            for (HttpCookie cookie : this.parsedList) {
                if (name.equals(cookie.getName())) {
                    list.add(cookie.getValue());
                }
            }
        }
        return added;
    }