public final class HttpHeaders extends Object
Modifier and Type | Method and Description |
---|---|
static long |
contentLength(Headers headers) |
static long |
contentLength(Response response) |
static boolean |
hasBody(Response response)
Returns true if the response must have a (possibly 0-length) body.
|
static boolean |
hasVaryAll(Headers responseHeaders)
Returns true if a Vary header contains an asterisk.
|
static boolean |
hasVaryAll(Response response)
Returns true if a Vary header contains an asterisk.
|
static List<Challenge> |
parseChallenges(Headers responseHeaders,
String challengeHeader)
Parse RFC 7617 challenges, also wrong ordered ones.
|
static int |
parseSeconds(String value,
int defaultValue)
Returns
value as a positive integer, or 0 if it is negative, or defaultValue if
it cannot be parsed. |
static void |
receiveHeaders(CookieJar cookieJar,
HttpUrl url,
Headers headers) |
static int |
skipUntil(String input,
int pos,
String characters)
Returns the next index in
input at or after pos that contains a character from
characters . |
static int |
skipWhitespace(String input,
int pos)
Returns the next non-whitespace character in
input that is white space. |
static Set<String> |
varyFields(Headers responseHeaders)
Returns the names of the request headers that need to be checked for equality when caching.
|
static Headers |
varyHeaders(Headers requestHeaders,
Headers responseHeaders)
Returns the subset of the headers in
requestHeaders that impact the content of
response's body. |
static Headers |
varyHeaders(Response response)
Returns the subset of the headers in
response 's request that impact the content of
response's body. |
static boolean |
varyMatches(Response cachedResponse,
Headers cachedRequest,
Request newRequest)
Returns true if none of the Vary headers have changed between
cachedRequest and newRequest . |
public static long contentLength(Response response)
public static long contentLength(Headers headers)
public static boolean varyMatches(Response cachedResponse, Headers cachedRequest, Request newRequest)
cachedRequest
and newRequest
.public static boolean hasVaryAll(Response response)
public static boolean hasVaryAll(Headers responseHeaders)
public static Set<String> varyFields(Headers responseHeaders)
public static Headers varyHeaders(Response response)
response
's request that impact the content of
response's body.public static Headers varyHeaders(Headers requestHeaders, Headers responseHeaders)
requestHeaders
that impact the content of
response's body.public static List<Challenge> parseChallenges(Headers responseHeaders, String challengeHeader)
public static boolean hasBody(Response response)
public static int skipUntil(String input, int pos, String characters)
input
at or after pos
that contains a character from
characters
. Returns the input length if none of the requested characters can be found.public static int skipWhitespace(String input, int pos)
input
that is white space. Result is
undefined if input contains newline characters.public static int parseSeconds(String value, int defaultValue)
value
as a positive integer, or 0 if it is negative, or defaultValue
if
it cannot be parsed.Copyright © 2018. All rights reserved.