Reusable HttpResponse in android network programming?
As using the network package which apache provides, we usually do :
HttpRespons开发者_如何转开发e resp = httpClient.execute(httpRequest);
When I retrieve the HttpEntity object of the response, open the InputStream and extract the data in it, the HttpResponse object becomes unusable. If I try to do the thing again, exception occurs.
Here I wish to reuse the HttpResponse, mostly for caching. But the HttpResponse object returned is type interface, I cannot call clone.
Is there any way I can reuse the HttpResponse ?
I think this behavior is by concept and cannot be changed. Why don't you cache the data you read from the response? You've already read them so why not store them somewhere where they can be centrally accessed?
精彩评论