code: public static Map createCookieMap(PageContext pContext)
      {
          // Read all the cookies and construct the entire map
          HttpServletRequest request = (HttpServletRequest) pContext.getRequest();
          Cookie[] cookies = request.getCookies();
          Map ret = new HashMap();
  
          for (int i = 0; cookies != null && i < cookies.length; i++) {
              Cookie cookie = cookies[i];
              if (cookie != null) {
                  String name = cookie.getName();
                  if (!ret.containsKey(name)) {
                      ret.put(name, cookie);
                  }
              }
          }
          return ret;
      }
docs: Creates the Map that maps cookie name to the first matching
  Cookie in request.getCookies().