OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.net; | |
6 | |
7 import android.util.Pair; | |
8 | |
9 import java.util.List; | |
10 import java.util.Map; | |
11 | |
12 /** | |
13 * Contains basic information about a response. Sent to the embedder whenever | |
14 * headers are received. | |
15 */ | |
16 public interface ResponseInfo { | |
17 /** | |
18 * Returns the URL the response is for. This is the URL after following | |
19 * redirects, so it may not be the originally requested URL. | |
20 * @return the URL the response is for. | |
21 */ | |
22 String getUrl(); | |
23 | |
24 /** | |
25 * Returns the URL chain. The first entry is the origianlly requested URL; | |
26 * the following entries are redirects followed. | |
27 * @return the URL chain. | |
28 */ | |
29 String[] getUrlChain(); | |
30 | |
31 /** | |
32 * Returns the HTTP status code. When a resource is retrieved from the cache
, | |
33 * whether it was revalidated or not, the original status code is returned. | |
34 * @return the HTTP status code. | |
35 */ | |
36 int getHttpStatusCode(); | |
37 | |
38 /** | |
39 * Returns the HTTP status text of the status line. For example, if the | |
40 * request has a "HTTP/1.1 200 OK" response, this method returns "OK". | |
41 * @return the HTTP status text of the status line. | |
42 */ | |
43 String getHttpStatusText(); | |
44 | |
45 /** | |
46 * Returns an unmodifiable list of response header field and value pairs. | |
47 * The headers are in the same order they are received over the wire. | |
48 * @return an unmodifiable list of response header field and value pairs. | |
49 */ | |
50 List<Pair<String, String>> getAllHeadersAsList(); | |
51 | |
52 /** | |
53 * Returns an unmodifiable map of the response-header fields and values. | |
54 * Each list of values for a single header field is in the same order they | |
55 * were received over the wire. | |
56 * @return an unmodifiable map of the response-header fields and values. | |
57 */ | |
58 Map<String, List<String>> getAllHeaders(); | |
59 | |
60 /** | |
61 * Returns {@code true} if the response came from the cache, including | |
62 * requests that were revalidated over the network before being retrieved | |
63 * from the cache. | |
64 * @return {@code true} if the response came from the cache, {@code false} | |
65 * otherwise. | |
66 */ | |
67 boolean wasCached(); | |
68 | |
69 /** | |
70 * Returns the protocol (e.g. "quic/1+spdy/3") negotiated with the server. | |
71 * Returns an empty string if no protocol was negotiated, the protocol is | |
72 * not known, or when using plain HTTP or HTTPS. | |
73 * @return the protocol negotiated with the server. | |
74 */ | |
75 // TODO(mef): Figure out what this returns in the cached case, both with | |
76 // and without a revalidation request. | |
77 String getNegotiatedProtocol(); | |
78 | |
79 /** | |
80 * Returns the proxy server that was used for the request. | |
81 * @return the proxy server that was used for the request. | |
82 */ | |
83 String getProxyServer(); | |
84 }; | |
OLD | NEW |