OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 private final String method; | 27 private final String method; |
28 private final String url; | 28 private final String url; |
29 private final String message; | 29 private final String message; |
30 private final AsyncHttpEvents events; | 30 private final AsyncHttpEvents events; |
31 private String contentType; | 31 private String contentType; |
32 | 32 |
33 /** | 33 /** |
34 * Http requests callbacks. | 34 * Http requests callbacks. |
35 */ | 35 */ |
36 public interface AsyncHttpEvents { | 36 public interface AsyncHttpEvents { |
37 public void onHttpError(String errorMessage); | 37 void onHttpError(String errorMessage); |
38 public void onHttpComplete(String response); | 38 void onHttpComplete(String response); |
39 } | 39 } |
40 | 40 |
41 public AsyncHttpURLConnection(String method, String url, String message, | 41 public AsyncHttpURLConnection(String method, String url, String message, |
42 AsyncHttpEvents events) { | 42 AsyncHttpEvents events) { |
43 this.method = method; | 43 this.method = method; |
44 this.url = url; | 44 this.url = url; |
45 this.message = message; | 45 this.message = message; |
46 this.events = events; | 46 this.events = events; |
47 } | 47 } |
48 | 48 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 + e.getMessage()); | 113 + e.getMessage()); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 // Return the contents of an InputStream as a String. | 117 // Return the contents of an InputStream as a String. |
118 private static String drainStream(InputStream in) { | 118 private static String drainStream(InputStream in) { |
119 Scanner s = new Scanner(in).useDelimiter("\\A"); | 119 Scanner s = new Scanner(in).useDelimiter("\\A"); |
120 return s.hasNext() ? s.next() : ""; | 120 return s.hasNext() ? s.next() : ""; |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |