UrlResponseInfo
Stay organized with collections
Save and categorize content based on your preferences.
Basic information about a response. Included in UrlRequest.Callback
callbacks. Each
onRedirectReceived()
callback gets a different
copy of UrlResponseInfo
describing a particular redirect response.
Public Constructor Summary
Public Method Summary
abstract
Map<String, List<String>>
|
getAllHeaders()
Returns an unmodifiable map of the response-header fields and values.
|
abstract
List<Entry<String, String>>
|
|
abstract
int
|
|
abstract
String
|
|
abstract
String
|
|
abstract
String
|
getProxyServer()
Returns the proxy server that was used for the request.
|
abstract
long
|
getReceivedByteCount()
Returns a minimum count of bytes received from the network to process this request.
|
abstract
String
|
getUrl()
Returns the URL the response is for.
|
abstract
List<String>
|
|
abstract
boolean
|
wasCached()
Returns true if the response came from the cache, including requests that were
revalidated over the network before being retrieved from the cache.
|
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Constructors
public
UrlResponseInfo
()
Public Methods
Returns an unmodifiable map of the response-header fields and values. Each list of values for
a single header field is in the same order they were received over the wire.
Returns
- an unmodifiable map of the response-header fields and values.
Returns an unmodifiable list of response header field and value pairs. The headers are in the
same order they are received over the wire.
Returns
- an unmodifiable list of response header field and value pairs.
public
abstract
int
getHttpStatusCode
()
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.
public
abstract
String
getHttpStatusText
()
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".
Returns
- the HTTP status text of the status line.
public
abstract
String
getNegotiatedProtocol
()
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.
Returns
- the protocol negotiated with the server.
public
abstract
String
getProxyServer
()
Returns the proxy server that was used for the request.
Returns
- the proxy server that was used for the request.
public
abstract
long
getReceivedByteCount
()
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.
Returns
- a minimum count of bytes received from the network to process this request.
public
abstract
String
getUrl
()
Returns the URL the response is for. This is the URL after following redirects, so it may not
be the originally requested URL.
Returns
- the URL the response is for.
public
abstract
List<String>
getUrlChain
()
Returns the URL chain. The first entry is the originally requested URL; the following entries
are redirects followed.
public
abstract
boolean
wasCached
()
Returns true
if the response came from the cache, including requests that were
revalidated over the network before being retrieved from the cache.
Returns
true
if the response came from the cache, false
otherwise.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-10-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-26 UTC."],[],[],null,["# UrlResponseInfo\n\npublic abstract class **UrlResponseInfo** extends Object \nBasic information about a response. Included in [UrlRequest.Callback](../../../../reference/org/chromium/net/UrlRequest.Callback.html) callbacks. Each\n[onRedirectReceived()](../../../../reference/org/chromium/net/UrlRequest.Callback.html#onRedirectReceived(org.chromium.net.UrlRequest,%20org.chromium.net.UrlResponseInfo,%20java.lang.String)) callback gets a different\ncopy of `UrlResponseInfo` describing a particular redirect response. \n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------|\n| | [UrlResponseInfo](../../../../reference/org/chromium/net/UrlResponseInfo.html#UrlResponseInfo())() |\n\n### Public Method Summary\n\n|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract Map\\\u003cString, List\\\u003cString\\\u003e\\\u003e | [getAllHeaders](../../../../reference/org/chromium/net/UrlResponseInfo.html#getAllHeaders())() Returns an unmodifiable map of the response-header fields and values. |\n| abstract List\\\u003cEntry\\\u003cString, String\\\u003e\\\u003e | [getAllHeadersAsList](../../../../reference/org/chromium/net/UrlResponseInfo.html#getAllHeadersAsList())() Returns an unmodifiable list of response header field and value pairs. |\n| abstract int | [getHttpStatusCode](../../../../reference/org/chromium/net/UrlResponseInfo.html#getHttpStatusCode())() Returns the HTTP status code. |\n| abstract String | [getHttpStatusText](../../../../reference/org/chromium/net/UrlResponseInfo.html#getHttpStatusText())() Returns the HTTP status text of the status line. |\n| abstract String | [getNegotiatedProtocol](../../../../reference/org/chromium/net/UrlResponseInfo.html#getNegotiatedProtocol())() Returns the protocol (for example 'quic/1+spdy/3') negotiated with the server. |\n| abstract String | [getProxyServer](../../../../reference/org/chromium/net/UrlResponseInfo.html#getProxyServer())() Returns the proxy server that was used for the request. |\n| abstract long | [getReceivedByteCount](../../../../reference/org/chromium/net/UrlResponseInfo.html#getReceivedByteCount())() Returns a minimum count of bytes received from the network to process this request. |\n| abstract String | [getUrl](../../../../reference/org/chromium/net/UrlResponseInfo.html#getUrl())() Returns the URL the response is for. |\n| abstract List\\\u003cString\\\u003e | [getUrlChain](../../../../reference/org/chromium/net/UrlResponseInfo.html#getUrlChain())() Returns the URL chain. |\n| abstract boolean | [wasCached](../../../../reference/org/chromium/net/UrlResponseInfo.html#wasCached())() Returns `true` if the response came from the cache, including requests that were revalidated over the network before being retrieved from the cache. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| Object | clone() |\n| boolean | equals(Object arg0) |\n| void | finalize() |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**UrlResponseInfo**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public abstract Map\\\u003cString, List\\\u003cString\\\u003e\\\u003e\n**getAllHeaders**\n()\n\nReturns an unmodifiable map of the response-header fields and values. Each list of values for\na single header field is in the same order they were received over the wire. \n\n##### Returns\n\n- an unmodifiable map of the response-header fields and values. \n\n#### public abstract List\\\u003cEntry\\\u003cString, String\\\u003e\\\u003e\n**getAllHeadersAsList**\n()\n\nReturns an unmodifiable list of response header field and value pairs. The headers are in the\nsame order they are received over the wire. \n\n##### Returns\n\n- an unmodifiable list of response header field and value pairs. \n\n#### public abstract int\n**getHttpStatusCode**\n()\n\nReturns the HTTP status code. When a resource is retrieved from the cache, whether it was\nrevalidated or not, the original status code is returned. \n\n##### Returns\n\n- the HTTP status code. \n\n#### public abstract String\n**getHttpStatusText**\n()\n\nReturns the HTTP status text of the status line. For example, if the request received a\n\"HTTP/1.1 200 OK\" response, this method returns \"OK\". \n\n##### Returns\n\n- the HTTP status text of the status line. \n\n#### public abstract String\n**getNegotiatedProtocol**\n()\n\nReturns the protocol (for example 'quic/1+spdy/3') negotiated with the server. Returns an\nempty string if no protocol was negotiated, the protocol is not known, or when using plain\nHTTP or HTTPS. \n\n##### Returns\n\n- the protocol negotiated with the server. \n\n#### public abstract String\n**getProxyServer**\n()\n\nReturns the proxy server that was used for the request. \n\n##### Returns\n\n- the proxy server that was used for the request. \n\n#### public abstract long\n**getReceivedByteCount**\n()\n\nReturns a minimum count of bytes received from the network to process this request. This\ncount may ignore certain overheads (for example IP and TCP/UDP framing, SSL handshake and\nframing, proxy handling). This count is taken prior to decompression (for example GZIP) and\nincludes headers and data from all redirects.\n\nThis value may change (even for one [UrlResponseInfo](../../../../reference/org/chromium/net/UrlResponseInfo.html) instance) as the request\nprogresses until completion, when [onSucceeded()](../../../../reference/org/chromium/net/UrlRequest.Callback.html#onSucceeded(org.chromium.net.UrlRequest,%20org.chromium.net.UrlResponseInfo)),\n[onFailed()](../../../../reference/org/chromium/net/UrlRequest.Callback.html#onFailed(org.chromium.net.UrlRequest,%20org.chromium.net.UrlResponseInfo,%20org.chromium.net.CronetException)), or [onCanceled()](../../../../reference/org/chromium/net/UrlRequest.Callback.html#onCanceled(org.chromium.net.UrlRequest,%20org.chromium.net.UrlResponseInfo)) is called. \n\n##### Returns\n\n- a minimum count of bytes received from the network to process this request. \n\n#### public abstract String\n**getUrl**\n()\n\nReturns the URL the response is for. This is the URL after following redirects, so it may not\nbe the originally requested URL. \n\n##### Returns\n\n- the URL the response is for. \n\n#### public abstract List\\\u003cString\\\u003e\n**getUrlChain**\n()\n\nReturns the URL chain. The first entry is the originally requested URL; the following entries\nare redirects followed. \n\n##### Returns\n\n- the URL chain. \n\n#### public abstract boolean\n**wasCached**\n()\n\nReturns `true` if the response came from the cache, including requests that were\nrevalidated over the network before being retrieved from the cache. \n\n##### Returns\n\n- `true` if the response came from the cache, `false` otherwise."]]