@SuppressWarnings("deprecation") @Override protected ClientHttpEngine initDefaultEngine() { ApacheHttpClient4Engine httpEngine = (ApacheHttpClient4Engine) super.initDefaultEngine(); if (proxyCredentials != null) { ((DefaultHttpClient) httpEngine.getHttpClient()).setCredentialsProvider(proxyCredentials); } return httpEngine; } }
public ApacheHttpClient43Engine(final HttpHost defaultProxy) { this.defaultProxy = defaultProxy; this.httpClient = createDefaultHttpClient(); this.allowClosingHttpClient = true; }
static ApacheHttpClientEngine create(HttpClient httpClient, boolean closeHttpClient) { return new ApacheHttpClient43Engine(httpClient, closeHttpClient); } }
.build(); ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient/*, localContext*/);
public synchronized Future<T> future(Future<T> httpFuture) { if (completed) { // already failed or fully buffered return httpFuture; } future = new ResultFuture<T>(httpFuture); future.copyHttpFutureResult(); if (!future.isDone() && hasResult) { // response(-headers) is available, but not yet the full response-stream. Return immediately the result future.completed(getResult()); } return future; }
@Override public synchronized void failed(Exception ex) { completed = true; if (future != null) future.failed(clientException(ex, null)); if (sharedStream != null) { sharedStream.setException(ioException(ex)); IOUtils.closeQuietly(sharedStream); } releaseResources(); }
@Override public synchronized boolean cancel() { completed = true; if (future != null) future.cancelledResult(); if (sharedStream != null) { sharedStream.setException(new IOException("cancelled")); IOUtils.closeQuietly(sharedStream); } releaseResources(); return true; }
@Override protected T buildResult(HttpContext context) throws Exception { if (buf != null) clientResponse.setConnection(new ContentInputStream(buf)); return responseExtractor.extractResult(clientResponse); }
@Override public synchronized void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException { if (sharedStream != null) sharedStream.consumeContent(decoder, ioctrl); }
ConnectionResponse(final ClientConfiguration configuration, final Map<String, Object> properties) { super(configuration); setProperties(properties); }
@Override protected void setInputStream(InputStream is) { stream = is; resetEntity(); }
@Override protected void setInputStream(InputStream is) { stream = is; resetEntity(); }
@Override protected synchronized void setInputStream(InputStream is) { stream = is; resetEntity(); }
@Override public void releaseConnection() throws IOException { releaseConnection(false); }
@Override public void releaseConnection() throws IOException { releaseConnection(true); }
@Override public synchronized void releaseConnection() throws IOException { releaseConnection(false); }
.build(); ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient/*, localContext*/);
static ApacheHttpClientEngine create(CloseableHttpClient httpClient) { return new ApacheHttpClient43Engine(httpClient); }
public ApacheHttpClient43Engine() { this.httpClient = createDefaultHttpClient(); this.allowClosingHttpClient = true; }
static ApacheHttpClientEngine create() { return new ApacheHttpClient43Engine(); }