@Test public void cookies() { HashRequestHeaders hs = withHeader(Http.Header.COOKIE, "foo=bar; aaa=bbb; c=what_the_hell; aaa=ccc", "$version=1; some=other; $Domain=google.com, aaa=eee, d=cool; $Domain=google.com; $Path=\"/foo\""); Parameters cookies = hs.cookies(); assertThat(cookies.all("foo"), contains("bar")); assertThat(cookies.all("c"), contains("what_the_hell")); assertThat(cookies.all("aaa"), contains("bbb", "ccc", "eee")); assertThat(cookies.all("some"), contains("other")); assertThat(cookies.all("d"), contains("cool")); }
@Override public Parameters cookies() { Parameters lCookies = this.cookies; if (lCookies == null) { synchronized (internalLock) { lCookies = this.cookies; if (lCookies == null) { List<Parameters> list = all(Http.Header.COOKIE).stream() .map(CookieParser::parse) .collect(Collectors.toList()); lCookies = Parameters.toUnmodifiableParameters(HashParameters.concat(list)); this.cookies = lCookies; } } } return lCookies; }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public Parameters cookies() { Parameters lCookies = this.cookies; if (lCookies == null) { synchronized (internalLock) { lCookies = this.cookies; if (lCookies == null) { List<Parameters> list = all(Http.Header.COOKIE).stream() .map(CookieParser::parse) .collect(Collectors.toList()); lCookies = Parameters.toUnmodifiableParameters(HashParameters.concat(list)); this.cookies = lCookies; } } } return lCookies; } }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public Parameters cookies() { Parameters lCookies = this.cookies; if (lCookies == null) { synchronized (internalLock) { lCookies = this.cookies; if (lCookies == null) { List<Parameters> list = all(Http.Header.COOKIE).stream() .map(CookieParser::parse) .collect(Collectors.toList()); lCookies = Parameters.toUnmodifiableParameters(HashParameters.concat(list)); this.cookies = lCookies; } } } return lCookies; } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public Parameters cookies() { Parameters lCookies = this.cookies; if (lCookies == null) { synchronized (internalLock) { lCookies = this.cookies; if (lCookies == null) { List<Parameters> list = all(Http.Header.COOKIE).stream() .map(CookieParser::parse) .collect(Collectors.toList()); lCookies = Parameters.toUnmodifiableParameters(HashParameters.concat(list)); this.cookies = lCookies; } } } return lCookies; } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); @Override Optional<MediaType> contentType(); @Override OptionalLong contentLength(); @Override Parameters cookies(); @Override List<MediaType> acceptedTypes(); @Override boolean isAccepted(MediaType mediaType); @Override Optional<MediaType> bestAccepted(MediaType... mediaTypes); @Override Optional<ZonedDateTime> acceptDatetime(); @Override Optional<ZonedDateTime> date(); @Override Optional<ZonedDateTime> ifModifiedSince(); @Override Optional<ZonedDateTime> ifUnmodifiedSince(); @Override Optional<URI> referer(); }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public Parameters cookies() { Parameters lCookies = this.cookies; if (lCookies == null) { synchronized (internalLock) { lCookies = this.cookies; if (lCookies == null) { List<Parameters> list = all(Http.Header.COOKIE).stream() .map(CookieParser::parse) .collect(Collectors.toList()); lCookies = Parameters.toUnmodifiableParameters(HashParameters.concat(list)); this.cookies = lCookies; } } } return lCookies; } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); @Override Optional<MediaType> contentType(); @Override OptionalLong contentLength(); @Override Parameters cookies(); @Override List<MediaType> acceptedTypes(); @Override boolean isAccepted(MediaType mediaType); @Override Optional<MediaType> bestAccepted(MediaType... mediaTypes); @Override Optional<ZonedDateTime> acceptDatetime(); @Override Optional<ZonedDateTime> date(); @Override Optional<ZonedDateTime> ifModifiedSince(); @Override Optional<ZonedDateTime> ifUnmodifiedSince(); @Override Optional<URI> referer();  }