/** * Used to find a specific `Header` by key from a {@link Collection} of `Header`s. * * @param headers the {@link Collection} of `Header`s to be searched * @param key the key of the desired `Header` * @return the `Header` with the matching key (or `null`) */ public static Header<?> find(final Collection<Header<?>> headers, final String key) { return headers.stream().filter((h) -> h.getKey().equalsIgnoreCase(key)).findFirst().orElse(null); }
/** * Used to find a specific `Header` by key from a {@link Collection} of `Header`s. * * @param headers the {@link Collection} of `Header`s to be searched * @param key the key of the desired `Header` * @return the `Header` with the matching key (or `null`) */ public static Header<?> find(final Collection<Header<?>> headers, final String key) { return headers.stream().filter((h) -> h.getKey().equalsIgnoreCase(key)).findFirst().orElse(null); }
/** * Used to find a specific `Header` by key from a {@link Collection} of `Header`s. * * @param headers the {@link Collection} of `Header`s to be searched * @param key the key of the desired `Header` * @return the `Header` with the matching key (or `null`) */ public static Header<?> find(final Collection<Header<?>> headers, final String key) { return headers.stream().filter((h) -> h.getKey().equalsIgnoreCase(key)).findFirst().orElse(null); }
fromServer.getHeaders().forEach(header -> headerLog.debug("Response-Header: {} -> {}", header.getKey(), header.getValue()));
fromServer.getHeaders().forEach(header -> headerLog.debug("Response-Header: {} -> {}", header.getKey(), header.getValue()));
@Override public int hashCode() { return Objects.hash(getKey(), getValue()); }
public static List<HttpCookie> cookies(final List<FromServer.Header<?>> headers) { final List<HttpCookie> cookies = new ArrayList<>(); for(FromServer.Header<?> header : headers) { if(header.getKey().equalsIgnoreCase("Set-Cookie") || header.getKey().equalsIgnoreCase("Set-Cookie2")) { final List<?> found = (List<?>) header.getParsed(); for(Object o : found) { cookies.add((HttpCookie) o); } } } return Collections.unmodifiableList(cookies); }
public static List<HttpCookie> cookies(final List<FromServer.Header<?>> headers) { final List<HttpCookie> cookies = new ArrayList<>(); for (FromServer.Header<?> header : headers) { if (header.getKey().equalsIgnoreCase("Set-Cookie") || header.getKey().equalsIgnoreCase("Set-Cookie2")) { final List<?> found = (List<?>) header.getParsed(); for (Object o : found) { cookies.add((HttpCookie) o); } } } return Collections.unmodifiableList(cookies); }
@Override public int hashCode() { return Objects.hash(getKey(), getValue()); }
@Override public int hashCode() { return Objects.hash(getKey(), getValue()); }
public static List<HttpCookie> cookies(final List<FromServer.Header<?>> headers) { final List<HttpCookie> cookies = new ArrayList<>(); for (FromServer.Header<?> header : headers) { if (header.getKey().equalsIgnoreCase("Set-Cookie") || header.getKey().equalsIgnoreCase("Set-Cookie2")) { final List<?> found = (List<?>) header.getParsed(); for (Object o : found) { cookies.add((HttpCookie) o); } } } return Collections.unmodifiableList(cookies); }