OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import java.net.URL; | |
8 import java.util.List; | 7 import java.util.List; |
9 import java.util.Map; | 8 import java.util.Map; |
10 | 9 |
11 /** | 10 /** |
12 * Contains basic information about a response. Sent to the embedder whenever | 11 * Contains basic information about a response. Sent to the embedder whenever |
13 * headers are received. | 12 * headers are received. |
14 */ | 13 */ |
15 public abstract interface ResponseInfo { | 14 public interface ResponseInfo { |
16 /** | 15 /** |
17 * Return the url the response is for (Not the original URL - after | 16 * @return the URL the response is for (Not the original URL - after |
18 * redirects, it's the new URL). | 17 * redirects, it's the new URL). Includes scheme, path, and query. |
19 */ | 18 */ |
20 URL getUrl(); | 19 String getUrl(); |
21 | 20 |
22 /** | 21 /** |
23 * | 22 * |
24 * @return the url chain, including all redirects. The originally | 23 * @return the url chain, including all redirects. The originally |
25 * requested URL is first. | 24 * requested URL is first. |
26 */ | 25 */ |
27 URL[] getUrlChain(); | 26 String[] getUrlChain(); |
28 | 27 |
29 /** | 28 /** |
30 * Returns the HTTP status code. | 29 * @return the HTTP status code. |
31 */ | 30 */ |
32 int getHttpStatusCode(); | 31 int getHttpStatusCode(); |
33 | 32 |
34 /** | 33 /** |
35 * Returns an unmodifiable map of the response-header fields and values. | 34 * @return an unmodifiable map of the response-header fields and values. |
36 * The null key is mapped to the HTTP status line for compatibility with | 35 * The null key is mapped to the HTTP status line for compatibility with |
37 * HttpUrlConnection. | 36 * HttpUrlConnection. |
38 */ | 37 */ |
39 Map<String, List<String>> getAllHeaders(); | 38 Map<String, List<String>> getAllHeaders(); |
40 | 39 |
41 /** True if the response came from the cache. Requests that were | 40 /** |
| 41 * @return True if the response came from the cache. Requests that were |
42 * revalidated over the network before being retrieved from the cache are | 42 * revalidated over the network before being retrieved from the cache are |
43 * considered cached. | 43 * considered cached. When a resource is retrieved from the cache |
| 44 * (Whether it was revalidated or not), getHttpStatusCode returns the |
| 45 * original status code. |
44 */ | 46 */ |
45 boolean wasCached(); | 47 boolean wasCached(); |
46 | 48 |
47 /** | 49 /** |
48 * | 50 * @return protocol (e.g. "quic/1+spdy/3") negotiated with server. Returns |
49 * @return | 51 * empty string if no protocol was negotiated, or the protocol is not known. |
| 52 * Returns empty when using plain http or https. |
| 53 * TODO(mef): Figure out what this returns in the cached case, both with |
| 54 * and without a revalidation request. |
50 */ | 55 */ |
51 boolean wasFetchedOverSPDY(); | 56 String getNegotiatedProtocol(); |
52 | |
53 /** | |
54 * | |
55 * @return | |
56 */ | |
57 boolean wasFetchedOverQUIC(); | |
58 }; | 57 }; |
OLD | NEW |