private static javax.servlet.http.Cookie getCookie(HttpServletRequest request, String cookieName) {
        javax.servlet.http.Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (javax.servlet.http.Cookie cookie : cookies) {
                if (cookie.getName().equals(cookieName)) {
                    return cookie;
                }
            }
        }
        return null;
    }
Returns the cookie with the given name from the request or {@code null} if no cookie
with that name could be found.

@param request    the current executing http request.
@param cookieName the name of the cookie to find and return.
@return the cookie with the given name from the request or {@code null} if no cookie
with that name could be found.
web/src/main/java/org/apache/shiro/web/servlet/SimpleCookie.java