code: 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;
      }
docs: Attempts to retrieve the {@link Cookie} with the specified name from the {@link
  HttpServletRequest}.
  
  <p>Returns the {@link Cookie} if a match is found in the request, otherwise gracefully
  returns null.
  
  @param name
  @param request
  @return