code: public static void addCookiesToResponse(List<Cookie> cookieList, HttpServletResponse resp) {
          Iterator<Cookie> iterator = cookieList.listIterator();
          while (iterator.hasNext()) {
              Cookie cookie = iterator.next();
              if (cookie != null) {
                  resp.addCookie(cookie);
              }
          }
      }
docs: Given a list of Cookie objects, set them into the HttpServletResponse.
  This method does not alter the cookies in any way.
  
  @param cookieList A List of Cookie objects
  @param resp HttpServletResponse into which to set the cookie