开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜