if (cookie.getComment() != null) { b.append(";Comment="); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getComment());
if (cookie.getComment() != null) { b.append(";Comment="); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getComment());
if (cookie.getComment() != null) { b.append(";Comment="); quote(b, cookie.getComment());
public String toString(NewCookie value) { StringBuilder sb = new StringBuilder(); sb.append(value.getName()).append('=').append(value.getValue()); if (value.getComment() != null) { sb.append(';').append(COMMENT).append('=').append(value.getComment()); } if (value.getDomain() != null) { sb.append(';').append(DOMAIN).append('=').append(value.getDomain()); } if (value.getMaxAge() != -1) { sb.append(';').append(MAX_AGE).append('=').append(value.getMaxAge()); } if (value.getPath() != null) { sb.append(';').append(PATH).append('=').append(value.getPath()); } if (value.isSecure()) { sb.append(';').append(SECURE); } sb.append(';').append(VERSION).append('=').append(value.getVersion()); return sb.toString(); }
public void addNewCookie(NewCookie cookie) { Cookie cook = new Cookie(cookie.getName(), cookie.getValue()); cook.setMaxAge(cookie.getMaxAge()); cook.setVersion(cookie.getVersion()); if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain()); if (cookie.getPath() != null) cook.setPath(cookie.getPath()); cook.setSecure(cookie.isSecure()); if (cookie.getComment() != null) cook.setComment(cookie.getComment()); response.addCookie(cook); }
/** * {@inheritDoc} */ public String toString(NewCookie cookie) { StringBuffer sb = new StringBuffer(); sb.append(cookie.getName()).append('=').append(HeaderHelper.addQuotesIfHasWhitespace(cookie.getValue())); sb.append(';').append("Version=").append(cookie.getVersion()); if (cookie.getComment() != null) sb.append(';').append("Comment=").append(HeaderHelper.addQuotesIfHasWhitespace(cookie.getComment())); if (cookie.getDomain() != null) sb.append(';').append("Domain=").append(HeaderHelper.addQuotesIfHasWhitespace(cookie.getDomain())); if (cookie.getPath() != null) sb.append(';').append("Path=").append(HeaderHelper.addQuotesIfHasWhitespace(cookie.getPath())); if (cookie.getMaxAge() != -1) sb.append(';').append("Max-Age=").append(HeaderHelper.addQuotesIfHasWhitespace("" + cookie.getMaxAge())); if (cookie.isSecure()) sb.append(';').append("Secure"); return sb.toString(); }
if (value.getComment() != null) { sb.append(';').append(COMMENT).append('=').append(maybeQuoteAll(value.getComment()));
if (cookie.getComment() != null) { sb.append(';').append("Comment=").append(addQuotesIfHasWhitespace(cookie.getComment()));
@Override public void addNewCookie(NewCookie cookie) { Cookie cook = new Cookie(cookie.getName(), cookie.getValue()); cook.setMaxAge(cookie.getMaxAge()); cook.setVersion(cookie.getVersion()); if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain()); if (cookie.getPath() != null) cook.setPath(cookie.getPath()); cook.setSecure(cookie.isSecure()); if (cookie.getComment() != null) cook.setComment(cookie.getComment()); if (cookie.isHttpOnly()) cook.setHttpOnly(true); this.response.addCookie(cook); } };
@Override public void addNewCookie(NewCookie cookie) { Cookie cook = new Cookie(cookie.getName(), cookie.getValue()); cook.setMaxAge(cookie.getMaxAge()); cook.setVersion(cookie.getVersion()); if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain()); if (cookie.getPath() != null) cook.setPath(cookie.getPath()); cook.setSecure(cookie.isSecure()); if (cookie.getComment() != null) cook.setComment(cookie.getComment()); if (cookie.isHttpOnly()) cook.setHttpOnly(true); this.response.addCookie(cook); } };
public String toString(NewCookie cookie) { StringBuilder b = new StringBuilder(); b.append(cookie.getName()).append('='); WriterUtil.appendQuotedIfWhitespace(b, cookie.getValue()); b.append(";").append("Version=").append(cookie.getVersion()); if (cookie.getComment() != null) { b.append(";Comment="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getComment()); } if (cookie.getDomain() != null) { b.append(";Domain="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getDomain()); } if (cookie.getPath() != null) { b.append(";Path="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getPath()); } if (cookie.getMaxAge()!=-1) { b.append(";Max-Age="); b.append(cookie.getMaxAge()); } if (cookie.isSecure()) b.append(";Secure"); return b.toString(); }
public String toString(NewCookie cookie) { StringBuilder b = new StringBuilder(); b.append(cookie.getName()).append('='); WriterUtil.appendQuotedIfWhitespace(b, cookie.getValue()); b.append(";").append("Version=").append(cookie.getVersion()); if (cookie.getComment() != null) { b.append(";Comment="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getComment()); } if (cookie.getDomain() != null) { b.append(";Domain="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getDomain()); } if (cookie.getPath() != null) { b.append(";Path="); WriterUtil.appendQuotedIfWhitespace(b, cookie.getPath()); } if (cookie.getMaxAge()!=-1) { b.append(";Max-Age="); b.append(cookie.getMaxAge()); } if (cookie.isSecure()) b.append(";Secure"); return b.toString(); }
if (cookie.getComment() != null) { b.append(";Comment="); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getComment());
if (cookie.getComment() != null) { b.append(";Comment="); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getComment());
if (cookie.getComment() != null) { b.append(";Comment="); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getComment());
@Override public String toString(NewCookie cookie) { if (cookie == null) { throw new IllegalArgumentException("Cookie is null"); } return buildCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie.isSecure()); }
public String toString(NewCookie cookie) { if (cookie == null) { throw new IllegalArgumentException(Messages.getMessage("cookieIsNull")); //$NON-NLS-1$ } return buildCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie .getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie .isSecure()); }
/** * Converts the Restlet JAX-RS NewCookie to a CookieSettings. * * @param newCookie * @return the converted CookieSetting * @throws IllegalArgumentException */ public static CookieSetting toRestletCookieSetting(NewCookie newCookie) throws IllegalArgumentException { if (newCookie == null) { return null; } return new CookieSetting(newCookie.getVersion(), newCookie.getName(), newCookie.getValue(), newCookie.getPath(), newCookie.getDomain(), newCookie.getComment(), newCookie.getMaxAge(), newCookie.isSecure()); }
/** * Converts the Restlet JAX-RS NewCookie to a CookieSettings. * * @param newCookie * @return the converted CookieSetting * @throws IllegalArgumentException */ public static CookieSetting toRestletCookieSetting(NewCookie newCookie) throws IllegalArgumentException { if (newCookie == null) { return null; } return new CookieSetting(newCookie.getVersion(), newCookie.getName(), newCookie.getValue(), newCookie.getPath(), newCookie.getDomain(), newCookie.getComment(), newCookie.getMaxAge(), newCookie.isSecure()); }
private void saveCookies(Exchange exchange, Client client, CookieHandler cookieHandler) { if (cookieHandler != null) { CookieStore cookieStore = cookieHandler.getCookieStore(exchange); for (NewCookie newCookie: client.getResponse().getCookies().values()) { HttpCookie cookie = new HttpCookie(newCookie.getName(), newCookie.getValue()); cookie.setComment(newCookie.getComment()); cookie.setDomain(newCookie.getDomain()); cookie.setHttpOnly(newCookie.isHttpOnly()); cookie.setMaxAge(newCookie.getMaxAge()); cookie.setPath(newCookie.getPath()); cookie.setSecure(newCookie.isSecure()); cookie.setVersion(newCookie.getVersion()); cookieStore.add(client.getCurrentURI(), cookie); } } }