Unthrown Exceptions
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@940061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80415614f7
commit
fd513425a1
|
@ -435,8 +435,7 @@ public class CachingHttpClient implements HttpClient {
|
||||||
return backendResponse;
|
return backendResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SizeLimitedResponseReader getResponseReader(HttpResponse backEndResponse)
|
protected SizeLimitedResponseReader getResponseReader(HttpResponse backEndResponse) {
|
||||||
throws IOException {
|
|
||||||
return new SizeLimitedResponseReader(maxObjectSizeBytes, backEndResponse);
|
return new SizeLimitedResponseReader(maxObjectSizeBytes, backEndResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,7 @@ public class SizeLimitedResponseReader {
|
||||||
private byte[] sizeLimitedContent;
|
private byte[] sizeLimitedContent;
|
||||||
private boolean outputStreamConsumed;
|
private boolean outputStreamConsumed;
|
||||||
|
|
||||||
public SizeLimitedResponseReader(int maxResponseSizeBytes, HttpResponse response)
|
public SizeLimitedResponseReader(int maxResponseSizeBytes, HttpResponse response) {
|
||||||
throws IOException {
|
|
||||||
this.maxResponseSizeBytes = maxResponseSizeBytes;
|
this.maxResponseSizeBytes = maxResponseSizeBytes;
|
||||||
this.response = response;
|
this.response = response;
|
||||||
}
|
}
|
||||||
|
@ -116,14 +115,14 @@ public class SizeLimitedResponseReader {
|
||||||
return sizeLimitedContent;
|
return sizeLimitedContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse getReconstructedResponse() throws IOException {
|
public HttpResponse getReconstructedResponse() {
|
||||||
|
|
||||||
InputStream combinedStream = getCombinedInputStream();
|
InputStream combinedStream = getCombinedInputStream();
|
||||||
|
|
||||||
return constructResponse(response, combinedStream);
|
return constructResponse(response, combinedStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InputStream getCombinedInputStream() throws IOException {
|
protected InputStream getCombinedInputStream() {
|
||||||
InputStream input1 = new ByteArrayInputStream(getResponseBytes());
|
InputStream input1 = new ByteArrayInputStream(getResponseBytes());
|
||||||
InputStream input2 = getContentInputStream();
|
InputStream input2 = getContentInputStream();
|
||||||
return new CombinedInputStream(input1, input2);
|
return new CombinedInputStream(input1, input2);
|
||||||
|
@ -134,7 +133,7 @@ public class SizeLimitedResponseReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpResponse constructResponse(HttpResponse originalResponse,
|
protected HttpResponse constructResponse(HttpResponse originalResponse,
|
||||||
InputStream combinedStream) throws IOException {
|
InputStream combinedStream) {
|
||||||
HttpResponse response = new BasicHttpResponse(originalResponse.getProtocolVersion(),
|
HttpResponse response = new BasicHttpResponse(originalResponse.getProtocolVersion(),
|
||||||
HttpStatus.SC_OK, "Success");
|
HttpStatus.SC_OK, "Success");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue