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 /** | 7 /** |
8 * HTTP request (GET, PUT or POST). | 8 * HTTP request (GET, PUT or POST). |
9 * Note: All methods must be called on the Executor passed in during creation. | 9 * Note: All methods must be called on the Executor passed in during creation. |
10 */ | 10 */ |
11 public abstract interface AsyncUrlRequest { | 11 public interface UrlRequest { |
12 /** | 12 /** |
13 * More setters go here. They may only be called before start (Maybe | 13 * More setters go here. They may only be called before start (Maybe |
14 * also allow during redirects). Could optionally instead use arguments | 14 * also allow during redirects). Could optionally instead use arguments |
15 * to URLRequestFactory when creating the request. | 15 * to URLRequestFactory when creating the request. |
16 */ | 16 */ |
17 | 17 |
18 /** | 18 /** |
19 * Sets the HTTP method verb to use for this request. | 19 * Sets the HTTP method verb to use for this request. |
20 * | 20 * |
21 * <p>The default when this method is not called is "GET" if the request has | 21 * <p>The default when this method is not called is "GET" if the request has |
22 * no body or "POST" if it does. | 22 * no body or "POST" if it does. |
23 * | 23 * |
24 * @param method Either "POST" or "PUT". | 24 * @param method "GET", "HEAD", "DELETE", "POST" or "PUT". |
25 */ | 25 */ |
26 public void setHttpMethod(String method); | 26 public void setHttpMethod(String method); |
27 | 27 |
28 /** | 28 /** |
29 * Adds a request header. Must be done before request has started. | 29 * Adds a request header. Must be done before request has started. |
30 * | 30 * |
31 * @param header Header name | 31 * @param header Header name |
32 * @param value Header value | 32 * @param value Header value |
33 */ | 33 */ |
34 public void addHeader(String header, String value); | 34 public void addHeader(String header, String value); |
35 | 35 |
36 /** | 36 /** |
37 * Starts the request, all callbacks go to listener. | 37 * Starts the request, all callbacks go to listener. |
38 * @param listener | 38 * @param listener |
39 */ | 39 */ |
40 public void start(AsyncUrlRequestListener listener); | 40 public void start(UrlRequestListener listener); |
41 | 41 |
42 /** | 42 /** |
43 * Can be called at any time. | 43 * Can be called at any time. |
44 */ | 44 */ |
45 public void cancel(); | 45 public void cancel(); |
46 | 46 |
47 /** | 47 /** |
48 * | 48 * |
49 * @return True if the request has been cancelled by the embedder. | 49 * @return True if the request has been cancelled by the embedder. |
50 * TBD(mmenke): False in all other cases (Including errors). | 50 * TBD(mmenke): False in all other cases (Including errors). |
(...skipping 23 matching lines...) Expand all Loading... |
74 */ | 74 */ |
75 public void resume(); | 75 public void resume(); |
76 | 76 |
77 /** | 77 /** |
78 * Note: There are deliberately no accessors for the results of the request | 78 * Note: There are deliberately no accessors for the results of the request |
79 * here. Having none removes any ambiguity over when they are populated, | 79 * here. Having none removes any ambiguity over when they are populated, |
80 * particularly in the redirect case. | 80 * particularly in the redirect case. |
81 */ | 81 */ |
82 } | 82 } |
83 | 83 |
OLD | NEW |