Skip to content

Commit 311f753

Browse files
committed
update HttpHandler
1 parent 9341c15 commit 311f753

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/src/com/lidroid/xutils/http/HttpHandler.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public class HttpHandler<T> extends PriorityAsyncTask<Object, Object, Void> impl
4242
private final AbstractHttpClient client;
4343
private final HttpContext context;
4444

45-
private final StringDownloadHandler mStringDownloadHandler = new StringDownloadHandler();
46-
private final FileDownloadHandler mFileDownloadHandler = new FileDownloadHandler();
47-
4845
private HttpRedirectHandler httpRedirectHandler;
4946

5047
public void setHttpRedirectHandler(HttpRedirectHandler httpRedirectHandler) {
@@ -242,9 +239,11 @@ private ResponseInfo<T> handleResponse(HttpResponse response) throws HttpExcepti
242239
if (isDownloadingFile) {
243240
autoResume = autoResume && OtherUtils.isSupportRange(response);
244241
String responseFileName = autoRename ? OtherUtils.getFileNameFromHttpResponse(response) : null;
245-
result = mFileDownloadHandler.handleEntity(entity, this, fileSavePath, autoResume, responseFileName);
242+
FileDownloadHandler downloadHandler = new FileDownloadHandler();
243+
result = downloadHandler.handleEntity(entity, this, fileSavePath, autoResume, responseFileName);
246244
} else {
247-
result = mStringDownloadHandler.handleEntity(entity, this, charset);
245+
StringDownloadHandler downloadHandler = new StringDownloadHandler();
246+
result = downloadHandler.handleEntity(entity, this, charset);
248247
if (HttpUtils.sHttpCache.isEnabled(requestMethod)) {
249248
HttpUtils.sHttpCache.put(requestUrl, (String) result, expiry);
250249
}

0 commit comments

Comments
 (0)