You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/27 11:21:42 UTC
[49/50] [abbrv] httpcomponents-website git commit: Updated project
web site for HttpClient 5.0-alpha2 release
Updated project web site for HttpClient 5.0-alpha2 release
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/project-website/trunk@1794810 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-website/commit/d1046cb6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-website/tree/d1046cb6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-website/diff/d1046cb6
Branch: refs/heads/master
Commit: d1046cb6a664b300c44c473256ffc4e6a23f0fb9
Parents: 2ab0e5f
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Thu May 11 11:41:17 2017 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu May 11 11:41:17 2017 +0000
----------------------------------------------------------------------
.../httpcomponents-client-4.5.x/quickstart.apt | 2 +-
.../httpcomponents-client-5.0.x/download.apt | 10 +-
.../examples-async.apt | 90 ++++++++
.../httpcomponents-client-5.0.x/examples.apt | 40 ++--
.../apt/httpcomponents-client-5.0.x/logging.apt | 88 --------
.../httpcomponents-client-5.0.x/quickstart.apt | 211 +++++++++++++++++++
src/site/apt/news.apt | 61 ++++++
src/site/site.xml | 4 +-
src/site/xdoc/downloads.xml | 62 ++++--
9 files changed, 436 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-4.5.x/quickstart.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-4.5.x/quickstart.apt b/src/site/apt/httpcomponents-client-4.5.x/quickstart.apt
index c4f4372..231c02b 100644
--- a/src/site/apt/httpcomponents-client-4.5.x/quickstart.apt
+++ b/src/site/apt/httpcomponents-client-4.5.x/quickstart.apt
@@ -30,7 +30,7 @@
HttpClient Quick Start
- [[1]] Download 'Binary' package of the latest HttpClient 4.3 release or configure
+ [[1]] Download 'Binary' package of the latest HttpClient 4.5 release or configure
dependency on {{{./httpclient/dependency-info.html}HttpClient}} and
{{{./fluent-hc/dependency-info.html}Fluent HC}} modules using a dependency manager of your
choice as described {{{./download.html}here}}.
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-5.0.x/download.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-5.0.x/download.apt b/src/site/apt/httpcomponents-client-5.0.x/download.apt
index 7d0c4d3..8aa8de0 100644
--- a/src/site/apt/httpcomponents-client-5.0.x/download.apt
+++ b/src/site/apt/httpcomponents-client-5.0.x/download.apt
@@ -43,14 +43,14 @@ HttpClient Downloads
{{{http://ant.apache.org/projects/ivy.html}Apache Ivy}},
you can create a dependency on HttpClient modules by using this information:
- {{{./httpclient/dependency-info.html}HttpClient}}
+ {{{./httpclient5/dependency-info.html}HttpClient}}
- {{{./httpclient-fluent/dependency-info.html}Fluent HC}}
+ {{{./httpclient5-fluent/dependency-info.html}Fluent HC}}
- {{{./httpclient-cache/dependency-info.html}HttpClient Cache}}
+ {{{./httpclient5-cache/dependency-info.html}HttpClient Cache}}
- {{{./httpclient-win/dependency-info.html}HttpClient Windows extensions}}
+ {{{./httpclient5-win/dependency-info.html}HttpClient Windows extensions}}
- {{{./httpclient-osgi/dependency-info.html}HttpClient OSGi}}
+ {{{./httpclient5-osgi/dependency-info.html}HttpClient OSGi}}
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-5.0.x/examples-async.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-5.0.x/examples-async.apt b/src/site/apt/httpcomponents-client-5.0.x/examples-async.apt
new file mode 100644
index 0000000..e564003
--- /dev/null
+++ b/src/site/apt/httpcomponents-client-5.0.x/examples-async.apt
@@ -0,0 +1,90 @@
+~~ ====================================================================
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~ ====================================================================
+~~
+~~ This software consists of voluntary contributions made by many
+~~ individuals on behalf of the Apache Software Foundation. For more
+~~ information on the Apache Software Foundation, please see
+~~ <http://www.apache.org/>.
+
+ ----------
+ HttpComponents HttpClient Examples
+ ----------
+ ----------
+ ----------
+
+HttpClient Examples (Async)
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java}
+ Asynchronous HTTP exchange}}
+
+ This example demonstrates a basic asynchronous HTTP request / response exchange.
+ Response content is buffered in memory for simplicity.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java}
+ Asynchronous HTTP exchange with content streaming}}
+
+ This example demonstrates an asynchronous HTTP request / response exchange with a full content
+ streaming.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java}
+ Pipelined HTTP/1.1 exchanges}}
+
+ This example demonstrates a pipelined execution of multiple HTTP/1.1 request / response exchanges.
+ Response content is buffered in memory for simplicity.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java}
+ Multiplexed HTTP/2 exchanges}}
+
+ This example demonstrates a multiplexed execution of multiple HTTP/2 request / response exchanges.
+ Response content is buffered in memory for simplicity.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java}
+ Request execution interceptors}}
+
+ This example demonstrates how to insert custom request interceptor and an execution interceptor to the
+ request execution chain.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java}
+ Message trailers}}
+
+ This example demonstrates how to use a custom execution interceptor to add trailers to all
+ outgoing request enclosing an entity..
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java}
+ Multiplexed HTTP/2 exchanges}}
+
+ This example demonstrates handling of HTTP/2 message exchanges pushed by the server.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java}
+ Client authentication}}
+
+ This example demonstrates execution of an HTTP request against a target site that requires user
+ authentication.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java}
+ Custom SSL context}}
+
+ This example demonstrates how to create secure connections with a custom SSL context.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java}
+ Connection eviction}}
+
+ This example demonstrates how to evict expired and idle connections from the connection pool.
+
+
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-5.0.x/examples.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-5.0.x/examples.apt b/src/site/apt/httpcomponents-client-5.0.x/examples.apt
index bf4d704..57ccc6f 100644
--- a/src/site/apt/httpcomponents-client-5.0.x/examples.apt
+++ b/src/site/apt/httpcomponents-client-5.0.x/examples.apt
@@ -28,9 +28,9 @@
----------
----------
-HttpClient Examples
+HttpClient Examples (Classic)
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientWithResponseHandler.java}Response handling}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientWithResponseHandler.java}Response handling}}
This example demonstrates how to process HTTP responses using a response handler. This is
the recommended way of executing HTTP requests and processing HTTP responses. This approach
@@ -39,73 +39,77 @@ HttpClient Examples
guarantees that the underlying HTTP connection will be released back to the connection manager
automatically in all cases.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java}Manual connection release}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientConnectionRelease.java}Manual connection release}}
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/hc/client5/http/examples/ClientConfiguration.java}HttpClient configuration}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/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/hc/client5/http/examples/ClientAbortMethod.java}Abort method}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientInterceptors.java}Request execution interceptors}}
+
+ This example demonstrates how to insert custom request interceptor and an execution interceptor to the
+ request execution chain.
+
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientAbortMethod.java}Abort method}}
This example demonstrates how to abort an HTTP request before its normal completion.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientAuthentication.java}Client authentication}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientAuthentication.java}Client authentication}}
This example uses HttpClient to execute an HTTP request against a target site that requires user
authentication.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java}Request via a proxy}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java}Request via a proxy}}
This example demonstrates how to send an HTTP request via a proxy.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java}Proxy authentication}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java}Proxy authentication}}
A simple example showing execution of an HTTP request over a secure connection tunneled through
an authenticating proxy.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java}Chunk encoded POST}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java}Chunk encoded POST}}
This example shows how to stream out a request entity using chunk encoding.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientCustomContext.java}Custom execution context}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientCustomContext.java}Custom execution context}}
This example demonstrates the use of a local HTTP context populated custom attributes.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientFormLogin.java}Form based logon}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientFormLogin.java}Form based logon}}
This example demonstrates how HttpClient can be used to perform form-based logon.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java}Threaded request execution}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java}Threaded request execution}}
An example that executes HTTP requests from multiple worker threads.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientCustomSSL.java}Custom SSL context}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientCustomSSL.java}Custom SSL context}}
This example demonstrates how to create secure connections with a custom SSL context.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java}Preemptive BASIC authentication}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java}Preemptive BASIC authentication}}
This example shows how HttpClient can be customized to authenticate preemptively using BASIC
scheme. Generally, preemptive authentication can be considered less secure than a response to
an authentication challenge and therefore discouraged.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java}Preemptive DIGEST authentication}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java}Preemptive DIGEST authentication}}
This example shows how HttpClient can be customized to authenticate preemptively using DIGEST
scheme. Generally, preemptive authentication can be considered less secure than a response to
an authentication challenge and therefore discouraged.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ProxyTunnelDemo.java}Proxy tunnel}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/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.
- * {{{./httpclient/examples/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java}Multipart encoded request entity}}
+ * {{{./httpclient5/examples/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java}Multipart encoded request entity}}
This example shows how to execute requests enclosing a multipart encoded entity.
-
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-5.0.x/logging.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-5.0.x/logging.apt b/src/site/apt/httpcomponents-client-5.0.x/logging.apt
index 03c412b..f693e85 100644
--- a/src/site/apt/httpcomponents-client-5.0.x/logging.apt
+++ b/src/site/apt/httpcomponents-client-5.0.x/logging.apt
@@ -198,91 +198,3 @@ Logging Practices
{{{https://logging.apache.org/log4j/2.x/manual/}
https://logging.apache.org/log4j/2.x/manual/}}.
-** {java.util.logging Examples}
-
- Since JDK 1.4 there has been a package
- {{{http://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html}
- java.util.logging}} that provides a logging framework similar to <<<Log4J>>>. By default it
- reads a config file from <<<$JAVA_HOME/jre/lib/logging.properties>>> which looks like this
- (comments stripped):
-
---------------------------------------
-handlers=java.util.logging.ConsoleHandler
-.level=INFO
-java.util.logging.FileHandler.pattern = %h/java%u.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 1
-java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
-java.util.logging.ConsoleHandler.level = INFO
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-com.xyz.foo.level = SEVERE
---------------------------------------
-
- To customize logging a custom <<<logging.properties>>> file should be created in the project
- directory. The location of this file must be passed to the JVM as asystem property. This can be
- done on the command line like so:
-
---------------------------------------
-$JAVA_HOME/java -Djava.util.logging.config.file=$HOME/myapp/logging.properties
--classpath $HOME/myapp/target/classes com.myapp.Main
---------------------------------------
-
- Alternatively {{{http://docs.oracle.com/javase/7/docs/api/java/util/logging/LogManager.html#readConfiguration(java.io.InputStream)"}
- LogManager#readConfiguration(InputStream)}} can be used to pass it the desired configuration.
-
- * Enable header wire + context logging - <<Best for Debugging>>
-
---------------------------------------
-.level = INFO
-
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.ConsoleHandler.level = ALL
-
-org.apache.http.level = FINEST
-org.apache.hc.client5.http.wire.level = SEVERE
---------------------------------------
-
- * Enable full wire + context logging
-
---------------------------------------
-.level = INFO
-
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.ConsoleHandler.level = ALL
-
-org.apache.http.level = FINEST
---------------------------------------
-
- * Enable context logging for connection management
-
---------------------------------------
-.level = INFO
-
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.ConsoleHandler.level = ALL
-
-org.apache.http.impl.conn.level = FINEST
---------------------------------------
-
- * Enable context logging for connection management / request execution
-
---------------------------------------
-.level = INFO
-
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.ConsoleHandler.level = ALL
-
-org.apache.http.impl.conn.level = FINEST
-org.apache.http.impl.client.level = FINEST
-org.apache.http.client.level = FINEST
---------------------------------------
-
- []
-
- More detailed information is available from the
- {{{http://docs.oracle.com/javase/7/docs/technotes/guides/logging/overview.html}
- Java Logging documentation}}.
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/httpcomponents-client-5.0.x/quickstart.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/httpcomponents-client-5.0.x/quickstart.apt b/src/site/apt/httpcomponents-client-5.0.x/quickstart.apt
new file mode 100644
index 0000000..74de067
--- /dev/null
+++ b/src/site/apt/httpcomponents-client-5.0.x/quickstart.apt
@@ -0,0 +1,211 @@
+~~ ====================================================================
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~ ====================================================================
+~~
+~~ This software consists of voluntary contributions made by many
+~~ individuals on behalf of the Apache Software Foundation. For more
+~~ information on the Apache Software Foundation, please see
+~~ <http://www.apache.org/>.
+
+ ----------
+ HttpClient Quick Start
+ ----------
+ ----------
+ ----------
+
+HttpClient Quick Start
+
+ [[1]] Download 'Binary' package of the latest HttpClient 5.0 release or configure
+ dependency on {{{./httpclient5/dependency-info.html}HttpClient}} and
+ {{{./httpclient5-fluent/dependency-info.html}Fluent HC}} modules using a dependency
+ manager of your choice as described {{{./download.html}here}}.
+
+ [[1]] HttpClient 5.0 requires Java 1.7 or newer.
+
+ [[1]] The below code fragment illustrates the execution of HTTP GET and POST requests using
+ HttpClient classic API.
+
+-------------
+
+CloseableHttpClient httpclient = HttpClients.createDefault();
+HttpGet httpGet = new HttpGet("http://targethost/homepage");
+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 call CloseableHttpResponse#close() from a finally clause.
+// Please note that if response content is not fully consumed the underlying
+// connection cannot be safely re-used and will be shut down and discarded
+// by the connection manager.
+try {
+ System.out.println(response1.getStatusLine());
+ HttpEntity entity1 = response1.getEntity();
+ // do something useful with the response body
+ // and ensure it is fully consumed
+ EntityUtils.consume(entity1);
+} finally {
+ response1.close();
+}
+
+HttpPost httpPost = new HttpPost("http://targethost/login");
+List <NameValuePair> nvps = new ArrayList <NameValuePair>();
+nvps.add(new BasicNameValuePair("username", "vip"));
+nvps.add(new BasicNameValuePair("password", "secret"));
+httpPost.setEntity(new UrlEncodedFormEntity(nvps));
+CloseableHttpResponse response2 = httpclient.execute(httpPost);
+
+try {
+ System.out.println(response2.getStatusLine());
+ HttpEntity entity2 = response2.getEntity();
+ // do something useful with the response body
+ // and ensure it is fully consumed
+ EntityUtils.consume(entity2);
+} finally {
+ response2.close();
+}
+-------------
+
+ Source can be downloaded
+ {{{./httpclient5/examples/org/apache/hc/client5/http/examples/QuickStart.java}here}}
+
+ [[1]] The same requests can be executed using a simpler, albeit less flexible, fluent API.
+
+-------------
+
+// The fluent API relieves the user from having to deal with manual deallocation of system
+// resources at the cost of having to buffer response content in memory in some cases.
+
+Request.Get("http://targethost/homepage")
+ .execute().returnContent();
+Request.Post("http://targethost/login")
+ .bodyForm(Form.form().add("username", "vip").add("password", "secret").build())
+ .execute().returnContent();
+
+-------------
+
+ Source can be downloaded
+ {{{./httpclient5-fluent/examples/org/apache/hc/client5/http/examples/fluent/FluentQuickStart.java}here}}
+
+ [[1]] The below code fragment illustrates the execution of HTTP requests using
+ HttpClient async API.
+
+-------------
+
+CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
+// Start the client
+httpclient.start();
+
+// Execute request
+final SimpleHttpRequest request1 = SimpleHttpRequest.get("http://httpbin.org/get");
+Future<SimpleHttpResponse> future = httpclient.execute(request1, null);
+// and wait until response is received
+final SimpleHttpResponse response1 = future.get();
+System.out.println(request1.getRequestUri() + "->" + response1.getCode());
+
+// One most likely would want to use a callback for operation result
+final CountDownLatch latch1 = new CountDownLatch(1);
+final SimpleHttpRequest request2 = SimpleHttpRequest.get("http://httpbin.org/get");
+httpclient.execute(request2, new FutureCallback<SimpleHttpResponse>() {
+
+ @Override
+ public void completed(final SimpleHttpResponse response2) {
+ latch1.countDown();
+ System.out.println(request2.getRequestUri() + "->" + response2.getCode());
+ }
+
+ @Override
+ public void failed(final Exception ex) {
+ latch1.countDown();
+ System.out.println(request2.getRequestUri() + "->" + ex);
+ }
+
+ @Override
+ public void cancelled() {
+ latch1.countDown();
+ System.out.println(request2.getRequestUri() + " cancelled");
+ }
+
+});
+latch1.await();
+
+// In real world one most likely would want also want to stream
+// request and response body content
+final CountDownLatch latch2 = new CountDownLatch(1);
+AsyncRequestProducer producer3 = AsyncRequestBuilder.get("http://httpbin.org/get").build();
+AbstractCharResponseConsumer<HttpResponse> consumer3 = new AbstractCharResponseConsumer<HttpResponse>() {
+
+ HttpResponse response;
+
+ @Override
+ protected void start(final HttpResponse response, final ContentType contentType) throws HttpException, IOException {
+ this.response = response;
+ }
+
+ @Override
+ protected int capacity() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ protected void data(final CharBuffer data, final boolean endOfStream) throws IOException {
+ // Do something useful
+ }
+
+ @Override
+ protected HttpResponse buildResult() throws IOException {
+ return response;
+ }
+
+ @Override
+ public HttpResponse getResult() {
+ return response;
+ }
+
+ @Override
+ public void releaseResources() {
+ }
+
+};
+httpclient.execute(producer3, consumer3, new FutureCallback<HttpResponse>() {
+
+ @Override
+ public void completed(final HttpResponse response3) {
+ latch2.countDown();
+ System.out.println(request2.getRequestUri() + "->" + response3.getCode());
+ }
+
+ @Override
+ public void failed(final Exception ex) {
+ latch2.countDown();
+ System.out.println(request2.getRequestUri() + "->" + ex);
+ }
+
+ @Override
+ public void cancelled() {
+ latch2.countDown();
+ System.out.println(request2.getRequestUri() + " cancelled");
+ }
+
+});
+latch2.await();
+---
+
+ Source can be downloaded
+ {{{./httpclient5/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java}here}}
+
+
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/apt/news.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/news.apt b/src/site/apt/news.apt
index 60abed5..eb8c279 100644
--- a/src/site/apt/news.apt
+++ b/src/site/apt/news.apt
@@ -30,6 +30,67 @@
HttpComponents Project News
+* 11 May 2017 - HttpComponents HttpCore 5.0-alpha3 released
+
+ This is a major release that introduces support for HTTP/2 protocol and event driven
+ messaging APIs consistent for all supported HTTP protocol versions.
+
+ HttpClient ships with two client implementations:
+
+ * Classic: it is based on the classic (blocking) I/O model; largely compatible
+ with the 4.x APIs; supports HTTP/1.1 only.
+
+ * Async: based on NIO model; new event driven APIs consistent for all supported
+ HTTP protocol versions; supports both HTTP/1.1 and HTTP/2.
+
+
+ Notable changes and features included in the 5.0 series are:
+
+ * Partial support for HTTP/2 protocol and conformance to requirements and
+ recommendations of the latest HTTP/2 protocol specification (RFC 7540, RFC 7541)
+
+ Supported features:
+
+ * HPACK header compression
+
+ * stream multiplexing (client and server)
+
+ * flow control
+
+ * response push
+
+ * message trailers
+
+ * expect-continue handshake
+
+ * connection validation (ping)
+
+ * application-layer protocol negotiation (ALPN) on Java 1.9+
+
+ * TLS 1.2 security features
+
+ * Improved conformance to requirements and recommendations of the latest HTTP/1.1 protocol
+ specification (RFC 7230, RFC 7231)
+
+ * Redesigned connection pool implementation with reduced pool lock contention.
+
+ * Package name space changed to 'org.apache.hc.client5'
+
+ * Maven group id changed to 'org.apache.httpcomponents.client5'
+
+ * Apache Log4j2 logging APIs used for internal logging instead of Commons Logging APIs
+
+
+ Fetures presently that are presently NOT supported:
+
+ * HTTP/2 transport (classic)
+
+ * HTTP tunneling (async)
+
+ * Automatic response content decompression (async)
+
+ * Caching (async)
+
* 2 May 2017 - HttpComponents HttpCore 5.0-alpha3 released
This is a major release that renders HttpCore API incompatible with the stable 4.x branch
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index b7759c2..4c51ae4 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -78,7 +78,9 @@
</menu>
<menu name="Components">
<item name="HttpClient 5.0 alpha" collapse="true" href="httpcomponents-client-5.0.x/index.html">
- <item name="Examples" href="httpcomponents-client-5.0.x/examples.html"/>
+ <item name="Quick Start" href="httpcomponents-client-5.0.x/quickstart.html"/>
+ <item name="Examples (Classic)" href="httpcomponents-client-5.0.x/examples.html"/>
+ <item name="Examples (Async)" href="httpcomponents-client-5.0.x/examples-async.html"/>
<item name="Logging Guide" href="httpcomponents-client-5.0.x/logging.html"/>
<item name="Download" href="httpcomponents-client-5.0.x/download.html"/>
<item name="Project Info" href="httpcomponents-client-5.0.x/project-info.html"/>
http://git-wip-us.apache.org/repos/asf/httpcomponents-website/blob/d1046cb6/src/site/xdoc/downloads.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/downloads.xml b/src/site/xdoc/downloads.xml
index 49c47fc..b1a0be6 100644
--- a/src/site/xdoc/downloads.xml
+++ b/src/site/xdoc/downloads.xml
@@ -104,6 +104,7 @@
[<a href="http://www.apache.org/dist/httpcomponents/httpclient/source/httpcomponents-client-4.5.3-src.zip.asc">pgp</a>]
</li>
</ul>
+ <p>Recent releases of HttpClient can be found <a href="[preferred]/httpcomponents/httpclient">here</a></p>
</subsection>
<subsection name="HttpCore 4.4.6 (GA)">
@@ -149,6 +150,48 @@
<p>Recent releases of HttpCore can be found <a href="[preferred]/httpcomponents/httpcore">here</a></p>
</subsection>
+ <subsection name="HttpClient 5.0-alpha2">
+ <a href="http://www.apache.org/dist/httpcomponents/httpclient/KEYS">KEYS</a>
+ <a href="http://www.apache.org/dist/httpcomponents/httpclient/RELEASE_NOTES-5.0.x.txt">Release Notes</a>
+ <br/>
+ <p>Binary</p>
+ <ul>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.tar.gz">5.0-alpha2.tar.gz</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.tar.gz.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.tar.gz.asc">pgp</a>]
+ </li>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.zip">5.0-alpha2.zip</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.zip.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-bin.zip.asc">pgp</a>]
+ </li>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.tar.gz">5.0-alpha2.tar.gz (OSGi bundle)</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.tar.gz.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.tar.gz.asc">pgp</a>]
+ </li>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.zip">5.0-alpha2.zip (OSGi bundle)</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.zip.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/binary/httpcomponents-client-5.0-alpha2-osgi-bin.zip.asc">pgp</a>]
+ </li>
+ </ul>
+ <p>Source</p>
+ <ul>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.tar.gz">5.0-alpha2.tar.gz</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.tar.gz.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.tar.gz.asc">pgp</a>]
+ </li>
+ <li>
+ <a href="[preferred]/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.zip">5.0-alpha2.zip</a>
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.zip.md5">md5</a>]
+ [<a href="http://www.apache.org/dist/httpcomponents/httpclient/source/httpcomponents-client-5.0-alpha2-src.zip.asc">pgp</a>]
+ </li>
+ </ul>
+ </subsection>
+
<subsection name="HttpCore 5.0-alpha3">
<a href="http://www.apache.org/dist/httpcomponents/httpcore/KEYS">KEYS</a>
<a href="http://www.apache.org/dist/httpcomponents/httpcore/RELEASE_NOTES-5.0.x.txt">Release Notes</a>
@@ -189,7 +232,6 @@
[<a href="http://www.apache.org/dist/httpcomponents/httpcore/source/httpcomponents-core-5.0-alpha3-src.zip.asc">pgp</a>]
</li>
</ul>
- <p>Recent releases of HttpCore can be found <a href="[preferred]/httpcomponents/httpcore">here</a></p>
</subsection>
<subsection name="HttpAsyncClient 4.1.3 (GA)">
@@ -224,24 +266,6 @@
</ul>
</subsection>
- <subsection name="HttpClient for Android 4.3.5 (GA)">
- <a href="http://www.apache.org/dist/httpcomponents/httpclient-android/KEYS">KEYS</a>
- <br/>
- <p>Source</p>
- <ul>
- <li>
- <a href="[preferred]/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.tar.gz">4.3.5.tar.gz</a>
- [<a href="http://www.apache.org/dist/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.tar.gz.md5">md5</a>]
- [<a href="http://www.apache.org/dist/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.tar.gz.asc">pgp</a>]
- </li>
- <li>
- <a href="[preferred]/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.zip">4.3.5.zip</a>
- [<a href="http://www.apache.org/dist/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.zip.md5">md5</a>]
- [<a href="http://www.apache.org/dist/httpcomponents/httpclient-android/source/httpcomponents-client-android-4.3.5-src.zip.asc">pgp</a>]
- </li>
- </ul>
- </subsection>
-
<subsection name="Older releases">
<p>
Old releases are available from the