Skip to content

Commit b34c4ff

Browse files
authored
Polish,Improve Code and Make Tests Passing (#1831)
1 parent ee6587d commit b34c4ff

File tree

353 files changed

+10231
-11286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+10231
-11286
lines changed

.github/workflows/maven.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow is designed to build PRs for AHC. Note that it does not actually publish AHC, just builds and test it.
22
# Docs: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: Build and Test PR
4+
name: Build PR
55

66
on:
77
push:
@@ -17,9 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v3
20+
- name: Grant Permission
21+
run: sudo chmod +x ./mvnw
2022
- uses: actions/setup-java@v3
2123
with:
2224
distribution: 'corretto'
2325
java-version: '11'
2426
- name: Run Tests
25-
run: mvn -B -ntp clean test
27+
run: ./mvnw -B -ntp clean test

.mvn/wrapper/maven-wrapper.jar

58.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://maven-central.storage-download.googleapis.com/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
18+
wrapperUrl=https://maven-central.storage-download.googleapis.com/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

bom/pom.xml

Lines changed: 0 additions & 108 deletions
This file was deleted.

client/pom.xml

Lines changed: 12 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,32 @@
33
<parent>
44
<groupId>org.asynchttpclient</groupId>
55
<artifactId>async-http-client-project</artifactId>
6-
<version>2.12.4-SNAPSHOT</version>
6+
<version>3.0.0-SNAPSHOT</version>
77
</parent>
8+
89
<modelVersion>4.0.0</modelVersion>
910
<artifactId>async-http-client</artifactId>
10-
<name>Asynchronous Http Client</name>
11+
<name>AHC/Client</name>
1112
<description>The Async Http Client (AHC) classes.</description>
1213

1314
<properties>
1415
<javaModuleName>org.asynchttpclient.client</javaModuleName>
1516
</properties>
1617

17-
<build>
18-
<plugins>
19-
<plugin>
20-
<artifactId>maven-jar-plugin</artifactId>
21-
<executions>
22-
<execution>
23-
<goals>
24-
<goal>test-jar</goal>
25-
</goals>
26-
</execution>
27-
</executions>
28-
</plugin>
29-
</plugins>
30-
</build>
31-
3218
<dependencies>
19+
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
3320
<dependency>
34-
<groupId>org.asynchttpclient</groupId>
35-
<artifactId>async-http-client-netty-utils</artifactId>
36-
<version>${project.version}</version>
37-
</dependency>
38-
<dependency>
39-
<groupId>io.netty</groupId>
40-
<artifactId>netty-codec-http</artifactId>
41-
</dependency>
42-
<dependency>
43-
<groupId>io.netty</groupId>
44-
<artifactId>netty-handler</artifactId>
45-
</dependency>
46-
<dependency>
47-
<groupId>io.netty</groupId>
48-
<artifactId>netty-codec-socks</artifactId>
49-
</dependency>
50-
<dependency>
51-
<groupId>io.netty</groupId>
52-
<artifactId>netty-handler-proxy</artifactId>
53-
</dependency>
54-
<dependency>
55-
<groupId>io.netty</groupId>
56-
<artifactId>netty-transport-native-epoll</artifactId>
57-
<classifier>linux-x86_64</classifier>
58-
</dependency>
59-
<dependency>
60-
<groupId>io.netty</groupId>
61-
<artifactId>netty-transport-native-kqueue</artifactId>
62-
<classifier>osx-x86_64</classifier>
63-
</dependency>
64-
<dependency>
65-
<groupId>org.reactivestreams</groupId>
66-
<artifactId>reactive-streams</artifactId>
67-
</dependency>
68-
<dependency>
69-
<groupId>com.typesafe.netty</groupId>
70-
<artifactId>netty-reactive-streams</artifactId>
71-
</dependency>
72-
<dependency>
73-
<groupId>io.reactivex.rxjava2</groupId>
74-
<artifactId>rxjava</artifactId>
75-
<scope>test</scope>
76-
</dependency>
77-
<dependency>
78-
<groupId>org.reactivestreams</groupId>
79-
<artifactId>reactive-streams-examples</artifactId>
21+
<groupId>commons-fileupload</groupId>
22+
<artifactId>commons-fileupload</artifactId>
23+
<version>1.4</version>
8024
<scope>test</scope>
8125
</dependency>
26+
27+
<!-- https://mvnrepository.com/artifact/javax.portlet/portlet-api -->
8228
<dependency>
83-
<groupId>org.apache.kerby</groupId>
84-
<artifactId>kerb-simplekdc</artifactId>
29+
<groupId>javax.portlet</groupId>
30+
<artifactId>portlet-api</artifactId>
31+
<version>3.0.1</version>
8532
<scope>test</scope>
8633
</dependency>
8734
</dependencies>

client/src/main/java/org/asynchttpclient/AsyncCompletionHandler.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@
2121
import org.slf4j.Logger;
2222
import org.slf4j.LoggerFactory;
2323

24+
import java.io.File;
25+
import java.io.InputStream;
26+
import java.util.concurrent.Future;
27+
2428
/**
2529
* An {@link AsyncHandler} augmented with an {@link #onCompleted(Response)}
2630
* convenience method which gets called when the {@link Response} processing is
2731
* finished. This class also implements the {@link ProgressAsyncHandler}
2832
* callback, all doing nothing except returning
29-
* {@link org.asynchttpclient.AsyncHandler.State#CONTINUE}
33+
* {@link AsyncHandler.State#CONTINUE}
3034
*
3135
* @param <T> Type of the value that will be returned by the associated
32-
* {@link java.util.concurrent.Future}
36+
* {@link Future}
3337
*/
3438
public abstract class AsyncCompletionHandler<T> implements ProgressAsyncHandler<T> {
3539

@@ -76,15 +80,15 @@ public void onThrowable(Throwable t) {
7680
*
7781
* @param response The {@link Response}
7882
* @return T Value that will be returned by the associated
79-
* {@link java.util.concurrent.Future}
83+
* {@link Future}
8084
* @throws Exception if something wrong happens
8185
*/
82-
abstract public T onCompleted(Response response) throws Exception;
86+
public abstract T onCompleted(Response response) throws Exception;
8387

8488
/**
8589
* Invoked when the HTTP headers have been fully written on the I/O socket.
8690
*
87-
* @return a {@link org.asynchttpclient.AsyncHandler.State} telling to CONTINUE
91+
* @return a {@link AsyncHandler.State} telling to CONTINUE
8892
* or ABORT the current processing.
8993
*/
9094
@Override
@@ -93,10 +97,10 @@ public State onHeadersWritten() {
9397
}
9498

9599
/**
96-
* Invoked when the content (a {@link java.io.File}, {@link String} or
97-
* {@link java.io.InputStream} has been fully written on the I/O socket.
100+
* Invoked when the content (a {@link File}, {@link String} or
101+
* {@link InputStream} has been fully written on the I/O socket.
98102
*
99-
* @return a {@link org.asynchttpclient.AsyncHandler.State} telling to CONTINUE
103+
* @return a {@link AsyncHandler.State} telling to CONTINUE
100104
* or ABORT the current processing.
101105
*/
102106
@Override
@@ -111,7 +115,7 @@ public State onContentWritten() {
111115
* @param amount The amount of bytes to transfer
112116
* @param current The amount of bytes transferred
113117
* @param total The total number of bytes transferred
114-
* @return a {@link org.asynchttpclient.AsyncHandler.State} telling to CONTINUE
118+
* @return a {@link AsyncHandler.State} telling to CONTINUE
115119
* or ABORT the current processing.
116120
*/
117121
@Override

client/src/main/java/org/asynchttpclient/AsyncCompletionHandlerBase.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
* Simple {@link AsyncHandler} of type {@link Response}
2222
*/
2323
public class AsyncCompletionHandlerBase extends AsyncCompletionHandler<Response> {
24-
/**
25-
* {@inheritDoc}
26-
*/
2724
@Override
2825
public Response onCompleted(Response response) throws Exception {
2926
return response;

client/src/main/java/org/asynchttpclient/AsyncHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import javax.net.ssl.SSLSession;
2323
import java.net.InetSocketAddress;
2424
import java.util.List;
25+
import java.util.concurrent.Future;
2526

2627

2728
/**
@@ -55,7 +56,7 @@
5556
* There's a chance you might end up in a dead lock.
5657
* If you really need to perform a blocking operation, execute it in a different dedicated thread pool.
5758
*
58-
* @param <T> Type of object returned by the {@link java.util.concurrent.Future#get}
59+
* @param <T> Type of object returned by the {@link Future#get}
5960
*/
6061
public interface AsyncHandler<T> {
6162

@@ -111,7 +112,7 @@ default State onTrailingHeadersReceived(HttpHeaders headers) throws Exception {
111112
* <br>
112113
* Gets always invoked as last callback method.
113114
*
114-
* @return T Value that will be returned by the associated {@link java.util.concurrent.Future}
115+
* @return T Value that will be returned by the associated {@link Future}
115116
* @throws Exception if something wrong happens
116117
*/
117118
T onCompleted() throws Exception;

client/src/main/java/org/asynchttpclient/AsyncHttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public interface AsyncHttpClient extends Closeable {
248248
*
249249
* @param request {@link Request}
250250
* @param handler an instance of {@link AsyncHandler}
251-
* @param <T> Type of the value that will be returned by the associated {@link java.util.concurrent.Future}
251+
* @param <T> Type of the value that will be returned by the associated {@link Future}
252252
* @return a {@link Future} of type T
253253
*/
254254
<T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler);
@@ -258,7 +258,7 @@ public interface AsyncHttpClient extends Closeable {
258258
*
259259
* @param requestBuilder {@link RequestBuilder}
260260
* @param handler an instance of {@link AsyncHandler}
261-
* @param <T> Type of the value that will be returned by the associated {@link java.util.concurrent.Future}
261+
* @param <T> Type of the value that will be returned by the associated {@link Future}
262262
* @return a {@link Future} of type T
263263
*/
264264
<T> ListenableFuture<T> executeRequest(RequestBuilder requestBuilder, AsyncHandler<T> handler);

0 commit comments

Comments
 (0)