Skip to content

Commit 05b77cb

Browse files
committed
added the Uploading file page
1 parent fb8c796 commit 05b77cb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/site/apt/upload.apt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
------
2+
Async Http Client - Uploading file: Progress Listener
3+
------
4+
Jeanfrancois Arcand
5+
------
6+
2012
7+
8+
Uploading file: Progress Listener
9+
10+
When uploading bytes, an application might need to take some action depending on where the upload status is.
11+
12+
The AsyncHttpClient library support a special <<<AsyncHandler>>> called <<<ProgressAsyncHandler>>> that can be used to
13+
track the upload operation:
14+
15+
+-----+
16+
public interface ProgressAsyncHandler<T> extends AsyncHandler<T> {
17+
STATE onHeaderWriteCompleted();
18+
STATE onContentWriteCompleted();
19+
STATE onContentWriteProgress(long amount, long current, long total);
20+
}
21+
+-----+
22+
23+
The methods are called in the following order:
24+
25+
* <<<onHeaderWriteCompleted>>>: invoked when the headers has been flushed to the remote server
26+
27+
* <<<onContentWriteProgress>>>: as soon as some response's body bytes are written. Might be invoked many times.
28+
29+
* <<<onContentWriteCompleted>>>: invoked when the response has been sent or aborted.
30+
31+
32+
Like with <<<AsyncHandler>>>, you can always always abort the processing at any moment in the upload process.

0 commit comments

Comments
 (0)