Skip to content

Commit bd26601

Browse files
committed
started adding maven generated documentation
1 parent ef39cbf commit bd26601

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

src/site/apt/request.apt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
------
2+
Async Http Client - Executing request
3+
------
4+
Jeanfrancois Arcand
5+
------
6+
2012
7+
8+
Executing request synchronously or asynchronously.
9+
10+
The first thing to decide when using the library is if your application can handle asynchronous response or not.
11+
If not, the library has been designed using the Future API, hence you can always execute synchronous call by blocking
12+
on the <<<Future.get()>>> method:
13+
14+
+-----+
15+
AsyncHttpClient client = new AsyncHttpClient();
16+
Response response = client.prepareGet(("http://sonatype.com").execute().get();
17+
+-----+
18+
19+
The above means the request will block until the full Response has been received. It also made your application's
20+
blocking, waiting for the response to comes back. This could be potentially an issue to block for every request,
21+
specially when doing <<<POST>>> or <<<PUT>>> operations where you don't necessarily need to wait for the response.
22+
A simple way consist of not calling the <<<Future.get()>>>
23+
24+
+-----+
25+
AsyncHttpClient client = new AsyncHttpClient();
26+
Response response = client.preparePut(("http://sonatype.com/myFile.avi").execute();
27+
+-----+
28+
29+
A better way than above would consist of using an AsyncHandler. The AynchHandler API is fairly simple and just
30+
consists of 5 methods to implements:
31+
32+
+-----+
33+
public interface AsyncHandler<T> {
34+
void onThrowable(Throwable t);
35+
36+
STATE onBodyPartReceived(HttpResponseBodyPart bodyPart)
37+
throws Exception;
38+
39+
STATE onStatusReceived(HttpResponseStatus responseStatus)
40+
throws Exception;
41+
42+
STATE onHeadersReceived(HttpResponseHeaders headers)
43+
throws Exception;
44+
45+
T onCompleted() throws Exception;
46+
}
47+
+-----+
48+

src/site/site.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
4+
name="${project.name}">
5+
6+
<skin>
7+
<groupId>org.apache.maven.skins</groupId>
8+
<artifactId>maven-fluido-skin</artifactId>
9+
<version>1.1</version>
10+
</skin>
11+
12+
<custom>
13+
<fluidoSkin>
14+
<topBarEnabled>true</topBarEnabled>
15+
<sideBarEnabled>false</sideBarEnabled>
16+
<twitter>
17+
<user>jfarcand</user>
18+
<showUser>true</showUser>
19+
<showFollowers>true</showFollowers>
20+
</twitter>
21+
</fluidoSkin>
22+
</custom>
23+
24+
<publishDate format="dd MMMM yyyy" position="left" />
25+
<version position="left" />
26+
27+
<body>
28+
<menu name="User guide">
29+
<item name="Executing request" href="request.html" />
30+
<item name="Configuring the AsyncHttpClient" href="configuring.html" />
31+
<item name="SSL" href="ssl.html" />
32+
<item name="Using Filters" href="filters.html" />
33+
<item name="Uploading file" href="uploading.html" />
34+
<item name="Authentication" href="authentication.html" />
35+
<item name="Proxy" href="proxy.html" />
36+
<item name="Switching Provider" href="providers.html" />
37+
<item name="Using the WebDav protocol" href="webdav.html" />
38+
<item name="Resumable Dowload" href="resumable-download.html" />
39+
<item name="TransferListener" href="transfer-listener.html" />
40+
<item name="Zero Bytes Copy" href="zero-bytes-copy.html" />
41+
<item name="Improve raw performance" href="performances.html" />
42+
<item name="OAuth" href="oauth.html" />
43+
</menu>
44+
45+
<menu ref="reports" inherit="bottom" />
46+
</body>
47+
</project>
48+

src/site/xdoc/index.xml.vm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
4+
5+
<properties>
6+
<title>Async Http Client - Home</title>
7+
<author>Jeanfrancois Arcand</author>
8+
</properties>
9+
10+
<body>
11+
<div class="hero-unit">
12+
<h1>Welcome to the Async Http Client!</h1>
13+
<p>The <span style="font-weight: bold">Async Http Client</span> library purpose is to allow Java applications to
14+
easily execute HTTP requests and asynchronously process the HTTP responses.
15+
The library also supports the WebSocket Protocol.</p>
16+
</div>
17+
18+
<section name="Get started">
19+
<p>The Async HTTP Client library is simple to use. First, in order to add it to your Maven project, simply add
20+
this dependency:</p>
21+
<source><![CDATA[<dependency>
22+
<groupId>${project.groupId}</groupId>
23+
<artifactId>${project.artifactId}</artifactId>
24+
<version>${project.version}</version>
25+
</dependency>]]></source>
26+
</section>
27+
</body>
28+
</document>

0 commit comments

Comments
 (0)