Skip to content

Commit

Permalink
update HttpHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Jul 26, 2014
1 parent 9341c15 commit 311f753
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions library/src/com/lidroid/xutils/http/HttpHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ public class HttpHandler<T> extends PriorityAsyncTask<Object, Object, Void> impl
private final AbstractHttpClient client;
private final HttpContext context;

private final StringDownloadHandler mStringDownloadHandler = new StringDownloadHandler();
private final FileDownloadHandler mFileDownloadHandler = new FileDownloadHandler();

private HttpRedirectHandler httpRedirectHandler;

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

0 comments on commit 311f753

Please sign in to comment.