/** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Cookie)) { // if obj isn't a cookie or is null don't evaluate further return false; } Cookie that = (Cookie) obj; return Objects.equals(getName(), that.getName()) && Objects.equals(getValue(), that.getValue()) && (this.version == that.version) && Objects.equals(getDomain(), that.getDomain()) && Objects.equals(getPath(), that.getPath()); }
/** {@inheritDoc} */ @Override public int hashCode() { return Engine.hashCode(super.hashCode(), getVersion(), getPath(), getDomain()); }
/** {@inheritDoc} */ @Override public int hashCode() { return SystemUtils.hashCode(getName(), getValue(), getVersion(), getPath(), getDomain()); }
/** {@inheritDoc} */ @Override public int hashCode() { return SystemUtils.hashCode(getName(), getValue(), getVersion(), getPath(), getDomain()); }
public CookieAdapter(org.restlet.data.Cookie target) { this.target = new CookieSetting( target.getVersion(), target.getName(), target.getValue(), target.getPath(), target.getDomain() ); }
/** * Converts a Restlet Cookie to a JAX-RS Cookie * * @param restletCookie * the Restlet Cookie * @return the JAX-RS Cookie */ public static Cookie toJaxRsCookie(org.restlet.data.Cookie restletCookie) { if (restletCookie == null) { return null; } return new Cookie(restletCookie.getName(), restletCookie.getValue(), restletCookie.getPath(), restletCookie.getDomain(), restletCookie.getVersion()); }
@Override public CookieWriter append(Cookie cookie) throws IllegalArgumentException { String name = cookie.getName(); String value = cookie.getValue(); int version = cookie.getVersion(); if ((name == null) || (name.length() == 0)) { throw new IllegalArgumentException( "Can't write cookie. Invalid name detected"); } appendValue(name, 0).append('='); // Append the value if ((value != null) && (value.length() > 0)) { appendValue(value, version); } if (version > 0) { // Append the path String path = cookie.getPath(); if ((path != null) && (path.length() > 0)) { append("; $Path="); appendQuotedString(path); } // Append the domain String domain = cookie.getDomain(); if ((domain != null) && (domain.length() > 0)) { append("; $Domain="); appendQuotedString(domain); } } return this; }