@Override public String getName() { return c.getName(); }
@Override public void setDomain( String domain ) { c.setDomain( domain ); }
@Override public String value() { return cookie.getValue(); }
@Override public RestxResponse clearCookie(String cookie, RestxSessionCookieDescriptor cookieDescriptor) { Cookie c = new Cookie(cookie, ""); c.setPath("/"); c.setExpiry(0); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
/** * Creates the <code>Cookie</code> from the token objects. It is * assumed that the <code>Cookie</code> <code>String</code> has * been parsed when this is called. This should only be used after * the <code>parse</code> method has been called. * <p> * If there is no <code>$Domain</code> or <code>$Path</code> * within the <code>Cookie</code> <code>String</code> then the * <code>getDomain</code> and <code>getPath</code> are null. * * @param name the name that the <code>Cookie</code> contains * @param value the value that the <code>Cookie</code> contains * * @return the <code>Cookie</code> that was just parsed */ private Cookie getCookie(String name, String value) { Cookie cookie = new Cookie(name, value, false); if(domain.len > 0) { cookie.setDomain(domain.toString()); } if(path.len > 0) { cookie.setPath(path.toString()); } cookie.setVersion(version); return cookie; }
@Override public void setCookie(Cookie newCookie) { CookieDate cookieDate = new CookieDate(); org.simpleframework.http.Cookie cookie = new org.simpleframework.http.Cookie(newCookie.name(), newCookie.value(), newCookie.path(), newCookie.isNew()) { @Override public String toString() { return getName() + "=" + getValue() + "; version=" + getVersion() + (getPath() == null ? "" : "; path=" + getPath()) + (getDomain() == null ? "" : "; domain=" + getDomain()) + (getExpiry() < 0 ? "" : "; expires=" + cookieDate.format(getExpiry())) + (getExpiry() < 0 ? "" : "; max-age=" + getExpiry()) + (isSecure() ? "; secure" : "") + (isProtected() ? "; httponly" : ""); } }; cookie.setExpiry(newCookie.expiry()); cookie.setVersion(newCookie.version()); cookie.setSecure(newCookie.isSecure()); cookie.setProtected(newCookie.isHttpOnly()); cookie.setDomain(newCookie.domain()); response.setCookie(cookie); }
public void setCookie(String name, String value) { Cookie cookie = new Cookie(name, value); response.setCookie(cookie); }
@Override public int getExpiry() { return c.getExpiry(); }
@Override public void setVersion( int version ) { c.setVersion( version ); }
@Override public void setPath( String path ) { c.setPath( path ); }
@Override public void setSecure( boolean secure ) { c.setSecure( secure ); }
@Override public void setExpiry( int expiry ) { c.setExpiry( expiry ); }
@Override public String domain() { return cookie.getDomain(); }
@Override public RestxResponse clearCookie(String cookie, RestxSessionCookieDescriptor cookieDescriptor) { Cookie c = new Cookie(cookie, ""); c.setPath("/"); c.setExpiry(0); if(cookieDescriptor.getDomain().isPresent()) { c.setDomain(cookieDescriptor.getDomain().get()); } if(cookieDescriptor.getSecure().isPresent()) { c.setSecure(cookieDescriptor.getSecure().get().booleanValue()); } response.setCookie(c); return this; }
/** * Creates the <code>Cookie</code> from the token objects. It is * assumed that the <code>Cookie</code> <code>String</code> has * been parsed when this is called. This should only be used after * the <code>parse</code> method has been called. * <p> * If there is no <code>$Domain</code> or <code>$Path</code> * within the <code>Cookie</code> <code>String</code> then the * <code>getDomain</code> and <code>getPath</code> are null. * * @param name the name that the <code>Cookie</code> contains * @param value the value that the <code>Cookie</code> contains * * @return the <code>Cookie</code> that was just parsed */ private Cookie getCookie(String name, String value) { Cookie cookie = new Cookie(name, value, false); if(domain.len > 0) { cookie.setDomain(domain.toString()); } if(path.len > 0) { cookie.setPath(path.toString()); } cookie.setVersion(version); return cookie; }
/** * The <code>setCookie</code> method is used to set a cookie value * with the cookie name. This will add a cookie to the response * stored under the name of the cookie, when this is committed it * will be added as a Set-Cookie header to the resulting response. * This is a convenience method that avoids cookie creation. * * @param name this is the cookie to be added to the response * @param value this is the cookie value that is to be used * * @return returns the cookie that has been set in the response */ public Cookie setCookie(String name, String value) { return setCookie(new Cookie(name, value, true)); }
@Override public int expiry() { return cookie.getExpiry(); }
@Override public String getDomain() { return c.getDomain(); }