/** * Adds a new {@link Cookie} created with the specified name and value to * this encoder. */ public void addCookie(String name, String value) { cookies.add(new DefaultCookie(name, value)); }
@Deprecated public String getComment() { return comment(); }
@Deprecated public String getCommentUrl() { return commentUrl(); }
DefaultCookie cookie = new DefaultCookie(name, unwrappedValue.toString()); cookie.setWrap(wrap); return cookie;
@Deprecated public String getName() { return name(); }
@Deprecated public String getPath() { return path(); }
@Deprecated public Set<Integer> getPorts() { return ports(); }
@Deprecated public String getDomain() { return domain(); }
@Deprecated public int getMaxAge() { return maxAge(); }
public boolean equals(Object o) { if (super.equals(o)) { SameSiteSupportingCookie oc = (SameSiteSupportingCookie)o; return this.sameSite.equalsIgnoreCase(oc.sameSite); } else { return false; } }
public int compareTo(Cookie c) { int result = super.compareTo(c); if (result == 0) { if (c instanceof SameSiteSupportingCookie) { SameSiteSupportingCookie sc = (SameSiteSupportingCookie) c; if (getSameSite() == null) { if (sc.getSameSite() == null) { return 0; } return -1; } if (sc.getSameSite() == null) { return 1; } return getSameSite().compareToIgnoreCase(sc.getSameSite()); } else { return 1; } } else { return result; } }
@Override public NettyHttpResponse cookie(HttpCookie httpCookie) { Cookie nettyCookie = new DefaultCookie(httpCookie.getName(),httpCookie.getValue()); nettyCookie.setDomain(httpCookie.getDomain()); nettyCookie.setPath(httpCookie.getPath()); nettyCookie.setSecure(httpCookie.getSecure()); nettyCookie.setMaxAge((int)httpCookie.getMaxAge()); nettyCookie.setVersion(httpCookie.getVersion()); nettyCookie.setDiscard(httpCookie.getDiscard()); nettyCookie.setHttpOnly(true); CookieEncoder encoder = new CookieEncoder(true); encoder.addCookie(nettyCookie); return header(HttpHeaders.Names.SET_COOKIE, encoder.encode()); }
@Override public NettyHttpResponse cookie(HttpCookie httpCookie) { Cookie nettyCookie = new DefaultCookie(httpCookie.getName(),httpCookie.getValue()); nettyCookie.setDomain(httpCookie.getDomain()); nettyCookie.setPath(httpCookie.getPath()); nettyCookie.setSecure(httpCookie.getSecure()); nettyCookie.setMaxAge((int)httpCookie.getMaxAge()); nettyCookie.setVersion(httpCookie.getVersion()); nettyCookie.setDiscard(httpCookie.getDiscard()); nettyCookie.setHttpOnly(true); CookieEncoder encoder = new CookieEncoder(true); encoder.addCookie(nettyCookie); return header(HttpHeaders.Names.SET_COOKIE, encoder.encode()); }