/** * Encodes the specified cookie into a Cookie header value. * * @param cookie the specified cookie * @return a Rfc6265 style Cookie header value */ public String encode(Cookie cookie) { StringBuilder buf = stringBuilder(); encode(buf, checkNotNull(cookie, "cookie")); return stripTrailingSeparator(buf); }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.size() == 1) { encode(buf, cookies.iterator().next()); } else { Cookie[] cookiesSorted = cookies.toArray(new Cookie[0]); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
StringBuilder buf = stringBuilder(); if (strict) { Cookie firstCookie = cookiesIt.next();
@Override public String toString() { StringBuilder buf = stringBuilder() .append(name()) .append('=') .append(value()); if (domain() != null) { buf.append(", domain=") .append(domain()); } if (path() != null) { buf.append(", path=") .append(path()); } if (maxAge() >= 0) { buf.append(", maxAge=") .append(maxAge()) .append('s'); } if (isSecure()) { buf.append(", secure"); } if (isHttpOnly()) { buf.append(", HTTPOnly"); } return buf.toString(); } }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Cookie... cookies) { if (checkNotNull(cookies, "cookies").length == 0) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.length == 1) { encode(buf, cookies[0]); } else { Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
StringBuilder buf = stringBuilder();
/** * Encodes the specified cookie into a Cookie header value. * * @param cookie the specified cookie * @return a Rfc6265 style Cookie header value */ public String encode(Cookie cookie) { StringBuilder buf = stringBuilder(); encode(buf, checkNotNull(cookie, "cookie")); return stripTrailingSeparator(buf); }
/** * Encodes the specified cookie into a Cookie header value. * * @param cookie the specified cookie * @return a Rfc6265 style Cookie header value */ public String encode(Cookie cookie) { StringBuilder buf = stringBuilder(); encode(buf, checkNotNull(cookie, "cookie")); return stripTrailingSeparator(buf); }
/** * Encodes the specified cookie into a Cookie header value. * * @param cookie the specified cookie * @return a Rfc6265 style Cookie header value */ public String encode(Cookie cookie) { StringBuilder buf = stringBuilder(); encode(buf, checkNotNull(cookie, "cookie")); return stripTrailingSeparator(buf); }
/** * Encodes the specified cookie into a Cookie header value. * * @param cookie the specified cookie * @return a Rfc6265 style Cookie header value */ public String encode(Cookie cookie) { StringBuilder buf = stringBuilder(); encode(buf, checkNotNull(cookie, "cookie")); return stripTrailingSeparator(buf); }
StringBuilder buf = stringBuilder(); if (strict) { Cookie firstCookie = cookiesIt.next();
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.size() == 1) { encode(buf, cookies.iterator().next()); } else { Cookie[] cookiesSorted = cookies.toArray(new Cookie[cookies.size()]); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.size() == 1) { encode(buf, cookies.iterator().next()); } else { Cookie[] cookiesSorted = cookies.toArray(new Cookie[0]); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Collection<? extends Cookie> cookies) { if (checkNotNull(cookies, "cookies").isEmpty()) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.size() == 1) { encode(buf, cookies.iterator().next()); } else { Cookie[] cookiesSorted = cookies.toArray(new Cookie[0]); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
@Override public String toString() { StringBuilder buf = stringBuilder() .append(name()) .append('=') .append(value()); if (domain() != null) { buf.append(", domain=") .append(domain()); } if (path() != null) { buf.append(", path=") .append(path()); } if (maxAge() >= 0) { buf.append(", maxAge=") .append(maxAge()) .append('s'); } if (isSecure()) { buf.append(", secure"); } if (isHttpOnly()) { buf.append(", HTTPOnly"); } return buf.toString(); } }
@Override public String toString() { StringBuilder buf = stringBuilder() .append(name()) .append('=') .append(value()); if (domain() != null) { buf.append(", domain=") .append(domain()); } if (path() != null) { buf.append(", path=") .append(path()); } if (maxAge() >= 0) { buf.append(", maxAge=") .append(maxAge()) .append('s'); } if (isSecure()) { buf.append(", secure"); } if (isHttpOnly()) { buf.append(", HTTPOnly"); } return buf.toString(); } }
@Override public String toString() { StringBuilder buf = stringBuilder() .append(name()) .append('=') .append(value()); if (domain() != null) { buf.append(", domain=") .append(domain()); } if (path() != null) { buf.append(", path=") .append(path()); } if (maxAge() >= 0) { buf.append(", maxAge=") .append(maxAge()) .append('s'); } if (isSecure()) { buf.append(", secure"); } if (isHttpOnly()) { buf.append(", HTTPOnly"); } return buf.toString(); } }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Cookie... cookies) { if (checkNotNull(cookies, "cookies").length == 0) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.length == 1) { encode(buf, cookies[0]); } else { Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Cookie... cookies) { if (checkNotNull(cookies, "cookies").length == 0) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.length == 1) { encode(buf, cookies[0]); } else { Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }
/** * Encodes the specified cookies into a single Cookie header value. * * @param cookies * some cookies * @return a Rfc6265 style Cookie header value, null if no cookies are passed. */ public String encode(Cookie... cookies) { if (checkNotNull(cookies, "cookies").length == 0) { return null; } StringBuilder buf = stringBuilder(); if (strict) { if (cookies.length == 1) { encode(buf, cookies[0]); } else { Cookie[] cookiesSorted = Arrays.copyOf(cookies, cookies.length); Arrays.sort(cookiesSorted, COOKIE_COMPARATOR); for (Cookie c : cookiesSorted) { encode(buf, c); } } } else { for (Cookie c : cookies) { encode(buf, c); } } return stripTrailingSeparatorOrNull(buf); }