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.nio.ByteBuffer; | 7 import java.nio.ByteBuffer; |
8 | 8 |
9 /** | 9 /** |
10 * Users of Cronet extend this class to receive callbacks indicating the | 10 * Users of Cronet extend this class to receive callbacks indicating the |
(...skipping 15 matching lines...) Expand all Loading... |
26 * | 26 * |
27 * The redirect will not be followed until the URLRequest's | 27 * The redirect will not be followed until the URLRequest's |
28 * {@link UrlRequest#followRedirect} method is called, either synchronously | 28 * {@link UrlRequest#followRedirect} method is called, either synchronously |
29 * or asynchronously. | 29 * or asynchronously. |
30 * | 30 * |
31 * @param request Request being redirected. | 31 * @param request Request being redirected. |
32 * @param info Response information. | 32 * @param info Response information. |
33 * @param newLocationUrl Location where request is redirected. | 33 * @param newLocationUrl Location where request is redirected. |
34 */ | 34 */ |
35 public abstract void onReceivedRedirect( | 35 public abstract void onReceivedRedirect( |
36 UrlRequest request, ResponseInfo info, String newLocationUrl); | 36 UrlRequest request, UrlResponseInfo info, String newLocationUrl); |
37 | 37 |
38 /** | 38 /** |
39 * Called when the final set of headers, after all redirects, is received. | 39 * Called when the final set of headers, after all redirects, is received. |
40 * Will only be called once for each request. | 40 * Will only be called once for each request. |
41 * | 41 * |
42 * No other UrlRequestListener method will be called for the request, | 42 * No other UrlRequestListener method will be called for the request, |
43 * including {@link UrlRequestListener#onSucceeded onSucceeded()} and {@link | 43 * including {@link UrlRequestListener#onSucceeded onSucceeded()} and {@link |
44 * UrlRequestListener#onFailed onFailed()}, until {@link UrlRequest#read | 44 * UrlRequestListener#onFailed onFailed()}, until {@link UrlRequest#read |
45 * UrlRequest.read()} is called to attempt to start reading the response | 45 * UrlRequest.read()} is called to attempt to start reading the response |
46 * body. | 46 * body. |
47 * | 47 * |
48 * @param request Request that started to get response. | 48 * @param request Request that started to get response. |
49 * @param info Response information. | 49 * @param info Response information. |
50 */ | 50 */ |
51 public abstract void onResponseStarted(UrlRequest request, ResponseInfo info
); | 51 public abstract void onResponseStarted(UrlRequest request, UrlResponseInfo i
nfo); |
52 | 52 |
53 /** | 53 /** |
54 * Called whenever part of the response body has been read. Only part of | 54 * Called whenever part of the response body has been read. Only part of |
55 * the buffer may be populated, even if the entire response body has not yet | 55 * the buffer may be populated, even if the entire response body has not yet |
56 * been consumed. | 56 * been consumed. |
57 * | 57 * |
58 * No other UrlRequestListener method will be called for the request, | 58 * No other UrlRequestListener method will be called for the request, |
59 * including {@link UrlRequestListener#onSucceeded onSucceeded()} and {@link | 59 * including {@link UrlRequestListener#onSucceeded onSucceeded()} and {@link |
60 * UrlRequestListener#onFailed onFailed()}, until {@link | 60 * UrlRequestListener#onFailed onFailed()}, until {@link |
61 * UrlRequest#read UrlRequest.read()} is called to attempt to continue | 61 * UrlRequest#read UrlRequest.read()} is called to attempt to continue |
62 * reading the response body. | 62 * reading the response body. |
63 * | 63 * |
64 * @param request Request that received data. | 64 * @param request Request that received data. |
65 * @param info Response information. | 65 * @param info Response information. |
66 * @param byteBuffer The buffer that was passed in to | 66 * @param byteBuffer The buffer that was passed in to |
67 * {@link UrlRequest#read}, now containing the received data. The | 67 * {@link UrlRequest#read}, now containing the received data. The |
68 * buffer's position is updated to the end of the received data. The | 68 * buffer's position is updated to the end of the received data. The |
69 * buffer's limit is not changed. | 69 * buffer's limit is not changed. |
70 */ | 70 */ |
71 public abstract void onReadCompleted( | 71 public abstract void onReadCompleted( |
72 UrlRequest request, ResponseInfo info, ByteBuffer byteBuffer); | 72 UrlRequest request, UrlResponseInfo info, ByteBuffer byteBuffer); |
73 | 73 |
74 /** | 74 /** |
75 * Called when request is completed successfully, no callbacks will be | 75 * Called when request is completed successfully, no callbacks will be |
76 * called afterwards. | 76 * called afterwards. |
77 * | 77 * |
78 * @param request Request that succeeded. | 78 * @param request Request that succeeded. |
79 * @param info Response information. | 79 * @param info Response information. |
80 */ | 80 */ |
81 public abstract void onSucceeded(UrlRequest request, ExtendedResponseInfo in
fo); | 81 public abstract void onSucceeded(UrlRequest request, UrlResponseInfo info); |
82 | 82 |
83 /** | 83 /** |
84 * Called if request failed for any reason after start(). Once | 84 * Called if request failed for any reason after start(). Once |
85 * called, no other functions can be called. UrlRequestException | 85 * called, no other functions can be called. UrlRequestException |
86 * provides information about error. | 86 * provides information about error. |
87 * | 87 * |
88 * @param request Request that failed. | 88 * @param request Request that failed. |
89 * @param info Response information. | 89 * @param info Response information. May be {@code null} if no response was
received. |
90 * @param error information about error. | 90 * @param error information about error. |
91 */ | 91 */ |
92 public abstract void onFailed(UrlRequest request, ResponseInfo info, UrlRequ
estException error); | 92 public abstract void onFailed( |
| 93 UrlRequest request, UrlResponseInfo info, UrlRequestException error)
; |
93 } | 94 } |
OLD | NEW |