Skip to content

Commit

Permalink
Small tweaks to MinimalHttpClient
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1430867 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ok2c committed Jan 9, 2013
1 parent aa92e0e commit 40bf945
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ public MinimalHttpClient(
this.params = new BasicHttpParams();
}

private HttpClientContext setupContext(final HttpContext localContext) {
HttpClientContext context = HttpClientContext.adapt(
localContext != null ? localContext : new BasicHttpContext());
return context;
}

@Override
protected CloseableHttpResponse doExecute(
final HttpHost target,
Expand All @@ -98,20 +92,16 @@ protected CloseableHttpResponse doExecute(
}
try {
HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(request);
HttpClientContext localcontext = setupContext(context);
HttpClientContext localcontext = HttpClientContext.adapt(
context != null ? context : new BasicHttpContext());
HttpRoute route = new HttpRoute(target);
RequestConfig config = null;
if (request instanceof Configurable) {
config = ((Configurable) request).getConfig();
}
if (config == null) {
config = RequestConfig.DEFAULT;
}
if (config.getProxy() != null) {
throw new ClientProtocolException("Minimal HttpClient does not support" +
" request execution via proxy");
if (config != null) {
localcontext.setRequestConfig(config);
}
localcontext.setRequestConfig(config);
return this.requestExecutor.execute(route, wrapper, localcontext, execAware);
} catch (HttpException httpException) {
throw new ClientProtocolException(httpException);
Expand Down

0 comments on commit 40bf945

Please sign in to comment.