public static List<String> toSetCookieHeaders(Iterable<? extends Cookie> cookies) {
        return StreamSupport.stream(cookies.spliterator(), false)
                .map(c -> {
                            var builder = HttpCookie.build(c.getName(), c.getValue())
                                    .domain(c.getDomain())
                                    .path(c.getPath())
                                    .maxAge(c.getMaxAge(TimeUnit.SECONDS))
                                    .secure(c.isSecure())
                                    .httpOnly(c.isHttpOnly());
                            if (c.getSameSite() != null) builder.sameSite(c.getSameSite().jettySameSite());
                            return HttpCookieUtils.getRFC6265SetCookie(builder.build());
                        }
                ).toList();
    }
A RFC 6265 compliant cookie.

Note: RFC 2109 and RFC 2965 is no longer supported. All fields that are not part of RFC 6265 are deprecated.

@author Einar M R Rosenvinge
@author bjorncs
container-core/src/main/java/com/yahoo/jdisc/http/Cookie.java