for ( NewCookie c : CookieJar.Cookies ) { logger.debug( "Setting cookie " + c.getName() ); wr.cookie( c ); }
/** * Get any new cookies set on the response message. * * @return a read-only map of cookie name (String) to a {@link javax.ws.rs.core.NewCookie new cookie}. */ public Map<String, NewCookie> getResponseCookies() { List<String> cookies = this.headers.get(HttpHeaders.SET_COOKIE); if (cookies == null || cookies.isEmpty()) { return Collections.emptyMap(); } Map<String, NewCookie> result = new HashMap<String, NewCookie>(); for (String cookie : cookies) { if (cookie != null) { NewCookie newCookie = HttpHeaderReader.readNewCookie(cookie); result.put(newCookie.getName(), newCookie); } } return result; }
/** * Get any new cookies set on the response message. * * @return a read-only map of cookie name (String) to a {@link javax.ws.rs.core.NewCookie new cookie}. */ public Map<String, NewCookie> getResponseCookies() { List<String> cookies = this.headers.get(HttpHeaders.SET_COOKIE); if (cookies == null || cookies.isEmpty()) { return Collections.emptyMap(); } Map<String, NewCookie> result = new HashMap<String, NewCookie>(); for (String cookie : cookies) { if (cookie != null) { NewCookie newCookie = HttpHeaderReader.readNewCookie(cookie); result.put(newCookie.getName(), newCookie); } } return result; }
/** * Get any new cookies set on the message message. * * @return a read-only map of cookie name (String) to a {@link javax.ws.rs.core.NewCookie new cookie}. */ public Map<String, NewCookie> getResponseCookies() { List<Object> cookies = headers.get(HttpHeaders.SET_COOKIE); if (cookies == null || cookies.isEmpty()) { return Collections.emptyMap(); } Map<String, NewCookie> result = new HashMap<String, NewCookie>(); for (String cookie : HeaderUtils.asStringList(cookies, RuntimeDelegate.getInstance())) { if (cookie != null) { NewCookie newCookie = HttpHeaderReader.readNewCookie(cookie); result.put(newCookie.getName(), newCookie); } } return result; }
/** * Get any new cookies set on the message message. * * @return a read-only map of cookie name (String) to a {@link javax.ws.rs.core.NewCookie new cookie}. */ public Map<String, NewCookie> getResponseCookies() { List<Object> cookies = headers.get(HttpHeaders.SET_COOKIE); if (cookies == null || cookies.isEmpty()) { return Collections.emptyMap(); } Map<String, NewCookie> result = new HashMap<String, NewCookie>(); for (String cookie : HeaderUtils.asStringList(cookies, RuntimeDelegate.getInstance())) { if (cookie != null) { NewCookie newCookie = HttpHeaderReader.readNewCookie(cookie); result.put(newCookie.getName(), newCookie); } } return result; }
b.append(cookie.getName()).append('='); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
b.append(cookie.getName()).append('='); StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
@Override public Map<String, NewCookie> getCookies() { Map<String, NewCookie> cookies = new HashMap<String, NewCookie>(); List list = metadata.get(HttpHeaders.SET_COOKIE); if (list == null) return cookies; for (Object obj : list) { if (obj instanceof NewCookie) { NewCookie cookie = (NewCookie)obj; cookies.put(cookie.getName(), cookie); } else { String str = toHeaderString(obj); NewCookie cookie = NewCookie.valueOf(str); cookies.put(cookie.getName(), cookie); } } return cookies; }
StringBuilder b = new StringBuilder(); b.append(cookie.getName()).append('=');
@Override public ResponseBuilder cookie(NewCookie... cookies) { Arrays.asList(cookies).forEach(cookie -> MSF4JResponse.this.cookies.put(cookie.getName(), cookie)); return this; }
public Map<String, NewCookie> getCookies() { List<Object> cookieValues = metadata.get(HttpHeaders.SET_COOKIE); if (cookieValues == null) { return Collections.emptyMap(); } Map<String, NewCookie> cookies = new HashMap<>(); for (Object o : cookieValues) { NewCookie newCookie = NewCookie.valueOf(o.toString()); cookies.put(newCookie.getName(), newCookie); } return cookies; }
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); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(),this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
/** * Obtain a new instance of a {@link Cookie} with the same name, value, path, * domain and version as this {@code NewCookie}. This method can be used to * obtain an object that can be compared for equality with another {@code Cookie}; * since a {@code Cookie} will never compare equal to a {@code NewCookie}. * * @return a {@link Cookie} */ public Cookie toCookie() { return new Cookie(this.getName(), this.getValue(), this.getPath(), this.getDomain(), this.getVersion()); }
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()); }