Find a specific HTTP cookie in a request.

@param request The HTTP request object.
@param name The cookie name to look for.
@return The cookie, or <code>null</code> if not found.
333942
public Cookie getCookieValueByName(final HttpServletRequest request,
            final String name) {
        if (request.getCookies() == null) {
            return null;
        }
        for (int i = 0; i < request.getCookies().length; i++) {
            if (request.getCookies()[i].getName().equals(name)) {
                return request.getCookies()[i];
            }
        }
        return null;
    }
421410
public static String findCookieValue(HttpServletRequest request, String name) {
        Cookie cookie = findCookie(request, name);
        return cookie != null ? cookie.getValue() : null;
    }
9590
public static String getHeader(HttpServletRequest request, String header) {

		// noting to search in or nothing to be found
		if (request == null || StringUtils.isNullOrEmptyTrimmed(header)) {
			return null;
		}

		return request.getHeader(header);
	}
634410
public final static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
		Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
		Cookie[] cookies = httpServletRequest.getCookies();
		if (null == cookies) {
			return null;
		}
		for (Cookie cookie : cookies) {
			cookieMap.put(cookie.getName().toLowerCase(), cookie);
		}
		return cookieMap;
	}
850996
public static String getCookieValue(String name, HttpServletRequest request) {
        Cookie cookie = getCookie(name, request);
        if (cookie != null) {
            return cookie.getValue();
        } else {
            return null;
        }
    }
734786
protected IPortalCookie getPortalCookie(HttpServletRequest request) {
        final Cookie cookie = this.getCookieFromRequest(this.cookieName, request);
        if (cookie == null) {
            // check the session
            IPortalCookie portalCookieInSession = locatePortalCookieInSession(request.getSession());
            if (null != portalCookieInSession) {
                return portalCookieInSession;
            }

            return null;
        }

        final String value = cookie.getValue();
        return this.portletCookieDao.getPortalCookie(value);
    }
898252
public String value(String name) {
        final HttpHeader header = getHeader(name);
        return header == null ? null : header.value();
    }
319925
public String getHtmlCookieString(String name, String value) {
        return getHtmlCookieString(name, value, null);
    }
30635
protected Cookie getCookieFromRequest(String name, HttpServletRequest request) {
        final Cookie[] cookies = request.getCookies();
        if (cookies == null) { // getCookies() returns null if there aren't any
            return null;
        }

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

        return null;
    }
337004
@Override
    public String cookieValue(String name) {
        return CookieHelper.getCookieValue(name, request().cookies());
    }
818739
@Override
    public Optional<WSCookie> getCookie(String name) {
        for (Cookie ahcCookie : ahcResponse.getCookies()) {
            // safe -- cookie.getName() will never return null
            if (ahcCookie.name().equals(name)) {
                return Optional.of(asCookie(ahcCookie));
            }
        }
        return Optional.empty();
    }
1093515
public String cookie(String name) {
        Cookie[] cookies = servletRequest.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals(name)) {
                    return cookie.getValue();
                }
            }
        }
        return null;
    }
744625
public List<YokeCookie> getAllCookies(@NotNull final String name) {
        List<YokeCookie> foundCookies = new ArrayList<>();
        if (cookies != null) {
            for (YokeCookie c : cookies) {
                if (name.equals(c.name())) {
                    foundCookies.add(c);
                }
            }
        }
        return foundCookies;
    }
331692
public static Cookie getCookie(final String name)
	{
		return ((WebRequest)RequestCycle.get().getRequest()).getCookie(name);
	}
516566
public static function getCookie(ServerRequestInterface $request, string $name): string
    {
        $cookies = $request->getCookieParams();

        return isset($cookies[$name]) ? $cookies[$name] : '-';
    }
948012
public void addCookie(String name, String value, HttpServletResponse response) {
        Cookie cookie = new Cookie(name, value);
        cookie.setHttpOnly(httpOnly);
        cookie.setSecure(secure);
        if (StringUtils.isNotEmpty(domain)) {
            cookie.setDomain(domain);
        }
        if (StringUtils.isNotEmpty(path)) {
            cookie.setPath(path);
        }
        if (maxAge != null) {
            cookie.setMaxAge(maxAge);
        }

        response.addCookie(cookie);

        logger.debug(LOG_KEY_ADDED_COOKIE, name);
    }
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;
	}