UrlResponseInfo


abstract class UrlResponseInfo
kotlin.Any
   ↳ android.net.http.UrlResponseInfo

Basic information about a response. Included in UrlRequest.Callback callbacks. Each onRedirectReceived() callback gets a different copy of UrlResponseInfo describing a particular redirect response.

Summary

Public constructors

Public methods
abstract HeaderBlock

Returns the response headers.

abstract Int

Returns the HTTP status code.

abstract String

Returns the HTTP status text of the status line.

abstract String

Returns the protocol (for example 'quic/1+spdy/3') negotiated with the server.

abstract Long

Returns a minimum count of bytes received from the network to process this request.

abstract String

Returns the URL the response is for.

abstract MutableList<String!>

Returns the URL chain.

abstract Boolean

Returns true if the response came from the cache, including requests that were revalidated over the network before being retrieved from the cache.

Public constructors

UrlResponseInfo

UrlResponseInfo()

Public methods

getHeaders

abstract fun getHeaders(): HeaderBlock

Returns the response headers.

Return
HeaderBlock This value cannot be null.

getHttpStatusCode

abstract fun getHttpStatusCode(): Int

Returns the HTTP status code. When a resource is retrieved from the cache, whether it was revalidated or not, the original status code is returned.

Return
Int the HTTP status code.

getHttpStatusText

abstract fun getHttpStatusText(): String

Returns the HTTP status text of the status line. For example, if the request received a "HTTP/1.1 200 OK" response, this method returns "OK".

Return
String the HTTP status text of the status line. This value cannot be null.

getNegotiatedProtocol

abstract fun getNegotiatedProtocol(): String

Returns the protocol (for example 'quic/1+spdy/3') negotiated with the server. Returns an empty string if no protocol was negotiated, the protocol is not known, or when using plain HTTP or HTTPS.

Return
String the protocol negotiated with the server. This value cannot be null.

getReceivedByteCount

abstract fun getReceivedByteCount(): Long

Returns a minimum count of bytes received from the network to process this request. This count may ignore certain overheads (for example IP and TCP/UDP framing, SSL handshake and framing, proxy handling). This count is taken prior to decompression (for example GZIP) and includes headers and data from all redirects. This value may change (even for one UrlResponseInfo instance) as the request progresses until completion, when onSucceeded(), onFailed(), or onCanceled() is called.

Return
Long a minimum count of bytes received from the network to process this request.

getUrl

abstract fun getUrl(): String

Returns the URL the response is for. This is the URL after following redirects, so it may not be the originally requested URL.

Return
String the URL the response is for. This value cannot be null.

getUrlChain

abstract fun getUrlChain(): MutableList<String!>

Returns the URL chain. The first entry is the originally requested URL; the following entries are redirects followed.

Return
MutableList<String!> the URL chain. This value cannot be null.

wasCached

abstract fun wasCached(): Boolean

Returns true if the response came from the cache, including requests that were revalidated over the network before being retrieved from the cache.

Return
Boolean true if the response came from the cache, false otherwise.