-
public final class HttpHeadersHeaders and utilities for internal use by OkHttp.
-
-
Method Summary
Modifier and Type Method Description static longcontentLength(MobonResponse mobonResponse)static longcontentLength(Headers headers)static booleanvaryMatches(MobonResponse cachedMobonResponse, Headers cachedRequest, MobonRequest newMobonRequest)Returns true if none of the Vary headers have changed between {@code cachedRequest}and{@code * newMobonRequest}.static booleanhasVaryAll(MobonResponse mobonResponse)Returns true if a Vary header contains an asterisk. static booleanhasVaryAll(Headers responseHeaders)Returns true if a Vary header contains an asterisk. static Set<String>varyFields(Headers responseHeaders)Returns the names of the request headers that need to be checked for equality when caching. static HeadersvaryHeaders(MobonResponse mobonResponse)Returns the subset of the headers in {@code mobonResponse}'s request that impact the content ofmobonResponse's body.static HeadersvaryHeaders(Headers requestHeaders, Headers responseHeaders)Returns the subset of the headers in {@code requestHeaders}that impact the content ofresponse's body.static List<Challenge>parseChallenges(Headers responseHeaders, String challengeHeader)Parse RFC 7617 challenges, also wrong ordered ones.This API is only interested in the scheme name and realm. static voidreceiveHeaders(CookieJar cookieJar, HttpUrl url, Headers headers)static booleanhasBody(MobonResponse mobonResponse)Returns true if the mobonResponse must have a (possibly 0-length) body. static intskipUntil(String input, int pos, String characters)Returns the next index in {@code input}at or after{@code pos}that contains a character from{@code characters}.static intskipWhitespace(String input, int pos)Returns the next non-whitespace character in {@code input}that is white space.static intparseSeconds(String value, int defaultValue)Returns {@code value}as a positive integer, or 0 if it is negative, or{@code defaultValue}ifit cannot be parsed.-
-
Method Detail
-
contentLength
static long contentLength(MobonResponse mobonResponse)
-
contentLength
static long contentLength(Headers headers)
-
varyMatches
static boolean varyMatches(MobonResponse cachedMobonResponse, Headers cachedRequest, MobonRequest newMobonRequest)
Returns true if none of the Vary headers have changed between
{@code cachedRequest}and{@code * newMobonRequest}.
-
hasVaryAll
static boolean hasVaryAll(MobonResponse mobonResponse)
Returns true if a Vary header contains an asterisk. Such responses cannot be cached.
-
hasVaryAll
static boolean hasVaryAll(Headers responseHeaders)
Returns true if a Vary header contains an asterisk. Such responses cannot be cached.
-
varyFields
static Set<String> varyFields(Headers responseHeaders)
Returns the names of the request headers that need to be checked for equality when caching.
-
varyHeaders
static Headers varyHeaders(MobonResponse mobonResponse)
Returns the subset of the headers in
{@code mobonResponse}'s request that impact the content ofmobonResponse's body.
-
varyHeaders
static Headers varyHeaders(Headers requestHeaders, Headers responseHeaders)
Returns the subset of the headers in
{@code requestHeaders}that impact the content ofresponse's body.
-
parseChallenges
static List<Challenge> parseChallenges(Headers responseHeaders, String challengeHeader)
Parse RFC 7617 challenges, also wrong ordered ones.This API is only interested in the scheme name and realm.
-
receiveHeaders
static void receiveHeaders(CookieJar cookieJar, HttpUrl url, Headers headers)
-
hasBody
static boolean hasBody(MobonResponse mobonResponse)
Returns true if the mobonResponse must have a (possibly 0-length) body. See RFC 7231.
-
skipUntil
static int skipUntil(String input, int pos, String characters)
Returns the next index in
{@code input}at or after{@code pos}that contains a character from{@code characters}. Returns the input length if none of the requested characters can be found.
-
skipWhitespace
static int skipWhitespace(String input, int pos)
Returns the next non-whitespace character in
{@code input}that is white space. Result isundefined if input contains newline characters.
-
parseSeconds
static int parseSeconds(String value, int defaultValue)
Returns
{@code value}as a positive integer, or 0 if it is negative, or{@code defaultValue}ifit cannot be parsed.
-
-
-
-