@@ -86,6 +86,10 @@ public void setCharset(final String charset) {
86
86
this .responseCharset = charset ;
87
87
}
88
88
89
+ public String getCharset () {
90
+ return this .responseCharset ;
91
+ }
92
+
89
93
/**
90
94
* Creates a new AsyncHttpResponseHandler
91
95
*/
@@ -172,8 +176,8 @@ public void onFailure(Throwable error, String content) {
172
176
* Fired when a request fails to complete, override to handle in your own code
173
177
*
174
178
* @param statusCode return HTTP status code
175
- * @param error the underlying cause of the failure
176
- * @param content the response body, if any
179
+ * @param error the underlying cause of the failure
180
+ * @param content the response body, if any
177
181
*/
178
182
public void onFailure (int statusCode , Throwable error , String content ) {
179
183
// By default, call the chain method onFailure(Throwable,String)
@@ -184,9 +188,9 @@ public void onFailure(int statusCode, Throwable error, String content) {
184
188
* Fired when a request fails to complete, override to handle in your own code
185
189
*
186
190
* @param statusCode return HTTP status code
187
- * @param headers return headers, if any
188
- * @param error the underlying cause of the failure
189
- * @param content the response body, if any
191
+ * @param headers return headers, if any
192
+ * @param error the underlying cause of the failure
193
+ * @param content the response body, if any
190
194
*/
191
195
public void onFailure (int statusCode , Header [] headers , Throwable error , String content ) {
192
196
// By default, call the chain method onFailure(int,Throwable,String)
@@ -216,7 +220,7 @@ protected void sendFailureMessage(int statusCode, Header[] headers, Throwable e,
216
220
}
217
221
218
222
@ Deprecated
219
- protected void sendFailureMessage ( Throwable e , byte [] responseBody ) {
223
+ protected void sendFailureMessage (Throwable e , byte [] responseBody ) {
220
224
sendMessage (obtainMessage (FAILURE_MESSAGE , new Object []{0 , null , e , responseBody }));
221
225
}
222
226
@@ -295,7 +299,7 @@ protected void sendResponseMessage(HttpResponse response) {
295
299
HttpEntity temp = response .getEntity ();
296
300
if (temp != null ) {
297
301
entity = new BufferedHttpEntity (temp );
298
- responseBody = EntityUtils .toString (entity , responseCharset );
302
+ responseBody = EntityUtils .toString (entity , getCharset () );
299
303
}
300
304
} catch (IOException e ) {
301
305
sendFailureMessage (status .getStatusCode (), response .getAllHeaders (), e , (String ) null );
0 commit comments