public static Cookie fromSetCookieHeader(String headerVal) {
        return java.net.HttpCookie.parse(headerVal).stream()
                .map(httpCookie -> {
                    Cookie cookie = new Cookie();
                    cookie.setName(httpCookie.getName());
                    cookie.setValue(httpCookie.getValue());
                    cookie.setDomain(httpCookie.getDomain());
                    cookie.setHttpOnly(httpCookie.isHttpOnly());
                    cookie.setMaxAge((int) httpCookie.getMaxAge(), TimeUnit.SECONDS);
                    cookie.setPath(httpCookie.getPath());
                    cookie.setSecure(httpCookie.getSecure());
                    return cookie;
                })
                .findFirst().get();
    }
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