Example usage for org.apache.http.impl.client.cache SizeLimitedResponseReader readResponse

List of usage examples for org.apache.http.impl.client.cache SizeLimitedResponseReader readResponse

Introduction

In this page you can find the example usage for org.apache.http.impl.client.cache SizeLimitedResponseReader readResponse.

Prototype

protected void readResponse() throws IOException 

Source Link

Usage

From source file:org.apache.http.impl.client.cache.BasicHttpCache.java

public HttpResponse cacheAndReturnResponse(HttpHost host, HttpRequest request, HttpResponse originResponse,
        Date requestSent, Date responseReceived) throws IOException {

    SizeLimitedResponseReader responseReader = getResponseReader(request, originResponse);
    responseReader.readResponse();

    if (responseReader.isLimitReached()) {
        return responseReader.getReconstructedResponse();
    }//from  ww  w .  j  a va  2s.  co m

    Resource resource = responseReader.getResource();
    if (isIncompleteResponse(originResponse, resource)) {
        return generateIncompleteResponseError(originResponse, resource);
    }

    HttpCacheEntry entry = new HttpCacheEntry(requestSent, responseReceived, originResponse.getStatusLine(),
            originResponse.getAllHeaders(), resource);
    storeInCache(host, request, entry);
    return responseGenerator.generateResponse(entry);
}