diff --git a/src/site/apt/download.apt b/src/site/apt/download.apt index 7d3d697a7..b7fda5779 100644 --- a/src/site/apt/download.apt +++ b/src/site/apt/download.apt @@ -42,46 +42,46 @@ HttpClient Downloads in your {{{http://maven.apache.org/guides/introduction/introduction-to-the-pom.html}pom.xml}} by adding the following block to the dependency descriptor: -* {HttpComponents Client 4.2.1} +* {HttpComponents Client 4.3 Alpha 1} ------------------------- org.apache.httpcomponents httpclient - 4.2.1 + 4.3-alpha1 compile ------------------------- -* {HttpComponents HttpMime 4.2.1} +* {HttpComponents HttpMime 4.3 Alpha 1} ------------------------- org.apache.httpcomponents httpmime - 4.2.1 + 4.3-alpha1 compile ------------------------- -* {HttpComponents HttpClient Cache 4.2.1} +* {HttpComponents HttpClient Cache 4.3 Alpha 1} ------------------------- org.apache.httpcomponents httpclient-cache - 4.2.1 + 4.3-alpha1 compile ------------------------- -* {HttpComponents HttpClient Fluent 4.2.1} +* {HttpComponents HttpClient Fluent 4.3 Alpha 1} ------------------------- org.apache.httpcomponents fluent-hc - 4.2.1 + 4.3-alpha1 compile ------------------------- diff --git a/src/site/apt/examples.apt b/src/site/apt/examples.apt index 36cfdfe46..c4b2e75d8 100644 --- a/src/site/apt/examples.apt +++ b/src/site/apt/examples.apt @@ -44,6 +44,11 @@ HttpClient Examples This example demonstrates how to ensure the release of the underlying HTTP connection back to the connection manager in case of a manual processing of HTTP responses. + * {{{./httpclient/examples/org/apache/http/examples/client/ClientConfiguration.java}HttpClient configuration}} + + This example demonstrates how to customize and configure the most common aspects of HTTP request execution + and connection management. + * {{{./httpclient/examples/org/apache/http/examples/client/ClientAbortMethod.java}Abort method}} This example demonstrates how to abort an HTTP request before its normal completion. @@ -106,6 +111,11 @@ HttpClient Examples scheme. Generally, preemptive authentication can be considered less secure than a response to an authentication challenge and therefore discouraged. + * {{{./httpclient/examples/org/apache/http/examples/client/ProxyTunnelDemo.java}Proxy tunnel}} + + This example shows how to use ProxyClient in order to establish a tunnel through an HTTP proxy + for an arbitrary protocol. + * {{{./httpmime/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java}Multipart encoded request entity}} This example shows how to execute requests enclosing a multipart encoded entity. diff --git a/src/site/apt/quickstart.apt b/src/site/apt/quickstart.apt index c003f50a2..4b0759f1d 100644 --- a/src/site/apt/quickstart.apt +++ b/src/site/apt/quickstart.apt @@ -56,16 +56,14 @@ HttpClient Quick Start ------------- -DefaultHttpClient httpclient = new DefaultHttpClient(); +CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet("http://targethost/homepage"); - - HttpResponse response1 = httpclient.execute(httpGet); - -// The underlying HTTP connection is still held by the response object -// to allow the response content to be streamed directly from the network socket. -// In order to ensure correct deallocation of system resources -// the user MUST either fully consume the response content or abort request -// execution by calling HttpGet#releaseConnection(). +CloseableHttpResponse response1 = httpclient.execute(httpGet); +// The underlying HTTP connection is still held by the response object +// to allow the response content to be streamed directly from the network socket. +// In order to ensure correct deallocation of system resources +// the user MUST either fully consume the response content or abort request +// execution by calling CloseableHttpResponse#close(). try { System.out.println(response1.getStatusLine()); @@ -74,7 +72,7 @@ try { // and ensure it is fully consumed EntityUtils.consume(entity1); } finally { - httpGet.releaseConnection(); + response1.close(); } HttpPost httpPost = new HttpPost("http://targethost/login"); @@ -82,7 +80,7 @@ List nvps = new ArrayList (); nvps.add(new BasicNameValuePair("username", "vip")); nvps.add(new BasicNameValuePair("password", "secret")); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); -HttpResponse response2 = httpclient.execute(httpPost); +CloseableHttpResponse response2 = httpclient.execute(httpPost); try { System.out.println(response2.getStatusLine()); @@ -91,9 +89,8 @@ try { // and ensure it is fully consumed EntityUtils.consume(entity2); } finally { - httpPost.releaseConnection(); + response2.close(); } - ------------- Source can be downloaded