Skip to content

Commit a2b1624

Browse files
authored
Prepare Release-Build (#1847)
1 parent 4c5d232 commit a2b1624

File tree

4 files changed

+187
-59
lines changed

4 files changed

+187
-59
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
name:
7+
description: 'Github Actions - Release'
8+
required: true
9+
default: 'Github Actions - Release'
10+
11+
jobs:
12+
13+
Publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Grant Permission
19+
run: sudo chmod +x ./mvnw
20+
21+
- uses: actions/setup-java@v3
22+
with:
23+
distribution: 'corretto'
24+
java-version: '11'
25+
26+
- name: Remove old Maven Settings
27+
run: rm -f /home/runner/.m2/settings.xml
28+
29+
- name: Maven Settings
30+
31+
with:
32+
servers: |
33+
[{
34+
"id": "ossrh",
35+
"username": "${{ secrets.OSSRH_USERNAME }}",
36+
"password": "${{ secrets.OSSRH_PASSWORD }}"
37+
}]
38+
39+
- name: Import GPG
40+
uses: crazy-max/[email protected]
41+
with:
42+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
43+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
44+
45+
- name: Build
46+
run: mvn -ntp -B clean verify install -DskipTests
47+
48+
- name: Publish to Maven Central
49+
env:
50+
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
51+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
52+
run: mvn -ntp -B deploy -DskipTests -Dgpg.keyname=${GPG_KEY_NAME} -Dgpg.passphrase=${GPG_PASSPHRASE}

README.md

Lines changed: 68 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Async Http Client [![Build](https://github.com/AsyncHttpClient/async-http-client/actions/workflows/builds.yml/badge.svg)](https://github.com/AsyncHttpClient/async-http-client/actions/workflows/builds.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.asynchttpclient/async-http-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.asynchttpclient/async-http-client/)
1+
# Async Http Client
2+
[![Build](https://github.com/AsyncHttpClient/async-http-client/actions/workflows/builds.yml/badge.svg)](https://github.com/AsyncHttpClient/async-http-client/actions/workflows/builds.yml)
3+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.asynchttpclient/async-http-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.asynchttpclient/async-http-client/)
24

35
Follow [@AsyncHttpClient](https://twitter.com/AsyncHttpClient) on Twitter.
46

@@ -18,7 +20,7 @@ Add a dependency on the main AsyncHttpClient artifact:
1820
<dependency>
1921
<groupId>org.asynchttpclient</groupId>
2022
<artifactId>async-http-client</artifactId>
21-
<version>3.0.0-SNAPSHOT</version>
23+
<version>3.0.0.Beta1</version>
2224
</dependency>
2325
</dependencies>
2426
```
@@ -140,17 +142,18 @@ The point of using a non blocking client is to *NOT BLOCK* the calling thread!
140142
You can configure listeners to be notified of the Future's completion.
141143

142144
```java
143-
ListenableFuture<Response> whenResponse=???;
144-
Runnable callback=()->{
145-
try{
146-
Response response=whenResponse.get();
147-
System.out.println(response);
148-
}catch(InterruptedException|ExecutionException e){
149-
e.printStackTrace();
150-
}
145+
ListenableFuture<Response> whenResponse = ???;
146+
Runnable callback = () - > {
147+
try {
148+
Response response = whenResponse.get();
149+
System.out.println(response);
150+
} catch (InterruptedException | ExecutionException e) {
151+
e.printStackTrace();
152+
}
151153
};
152-
java.util.concurrent.Executor executor=???;
153-
whenResponse.addListener(()->???,executor);
154+
155+
java.util.concurrent.Executor executor = ???;
156+
whenResponse.addListener(() - > ??? , executor);
154157
```
155158

156159
If the `executor` parameter is null, callback will be executed in the IO thread.
@@ -175,32 +178,38 @@ import static org.asynchttpclient.Dsl.*;
175178
import org.asynchttpclient.*;
176179
import io.netty.handler.codec.http.HttpHeaders;
177180

178-
Future<Integer> whenStatusCode=asyncHttpClient.prepareGet("http://www.example.com/")
179-
.execute(new AsyncHandler<Integer>(){
180-
private Integer status;
181-
@Override
182-
public State onStatusReceived(HttpResponseStatus responseStatus)throws Exception{
183-
status=responseStatus.getStatusCode();
184-
return State.ABORT;
185-
}
186-
@Override
187-
public State onHeadersReceived(HttpHeaders headers)throws Exception{
188-
return State.ABORT;
189-
}
190-
@Override
191-
public State onBodyPartReceived(HttpResponseBodyPart bodyPart)throws Exception{
192-
return State.ABORT;
193-
}
194-
@Override
195-
public Integer onCompleted()throws Exception{
196-
return status;
197-
}
198-
@Override
199-
public void onThrowable(Throwable t){
200-
}
181+
Future<Integer> whenStatusCode = asyncHttpClient.prepareGet("http://www.example.com/")
182+
.execute(new AsyncHandler<Integer> () {
183+
private Integer status;
184+
185+
@Override
186+
public State onStatusReceived(HttpResponseStatus responseStatus) throws Exception {
187+
status = responseStatus.getStatusCode();
188+
return State.ABORT;
189+
}
190+
191+
@Override
192+
public State onHeadersReceived(HttpHeaders headers) throws Exception {
193+
return State.ABORT;
194+
}
195+
196+
@Override
197+
public State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
198+
return State.ABORT;
199+
}
200+
201+
@Override
202+
public Integer onCompleted() throws Exception{
203+
return status;
204+
}
205+
206+
@Override
207+
public void onThrowable(Throwable t) {
208+
t.printStackTrace();
209+
}
201210
});
202211

203-
Integer statusCode=whenStatusCode.get();
212+
Integer statusCode = whenStatusCode.get();
204213
```
205214

206215
#### Using Continuations
@@ -232,23 +241,25 @@ WebSocket websocket=c.prepareGet("ws://demos.kaazing.com/echo")
232241
.execute(new WebSocketUpgradeHandler.Builder().addWebSocketListener(
233242
new WebSocketListener(){
234243

235-
@Override
236-
public void onOpen(WebSocket websocket){
237-
websocket.sendTextFrame("...").sendTextFrame("...");
238-
}
239-
240-
@Override
241-
public void onClose(WebSocket websocket){
242-
}
243-
244-
@Override
245-
public void onTextFrame(String payload,boolean finalFragment,int rsv){
246-
System.out.println(payload);
247-
}
248-
249-
@Override
250-
public void onError(Throwable t){
251-
}
244+
@Override
245+
public void onOpen(WebSocket websocket){
246+
websocket.sendTextFrame("...").sendTextFrame("...");
247+
}
248+
249+
@Override
250+
public void onClose(WebSocket websocket) {
251+
// ...
252+
}
253+
254+
@Override
255+
public void onTextFrame(String payload,boolean finalFragment,int rsv){
256+
System.out.println(payload);
257+
}
258+
259+
@Override
260+
public void onError(Throwable t){
261+
t.printStackTrace();
262+
}
252263
}).build()).get();
253264
```
254265

@@ -258,16 +269,16 @@ AsyncHttpClient has build in support for the WebDAV protocol.
258269
The API can be used the same way normal HTTP request are made:
259270

260271
```java
261-
Request mkcolRequest=new RequestBuilder("MKCOL").setUrl("http://host:port/folder1").build();
272+
Request mkcolRequest=new RequestBuilder("MKCOL").setUrl("http://host:port/folder1").build();
262273
Response response=c.executeRequest(mkcolRequest).get();
263274
```
264275

265276
or
266277

267278
```java
268-
Request propFindRequest=new RequestBuilder("PROPFIND").setUrl("http://host:port").build();
269-
Response response=c.executeRequest(propFindRequest,new AsyncHandler(){
270-
// ...
279+
Request propFindRequest=new RequestBuilder("PROPFIND").setUrl("http://host:port").build();
280+
Response response=c.executeRequest(propFindRequest,new AsyncHandler() {
281+
// ...
271282
}).get();
272283
```
273284

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<parent>
2020
<groupId>org.asynchttpclient</groupId>
2121
<artifactId>async-http-client-project</artifactId>
22-
<version>3.0.0-SNAPSHOT</version>
22+
<version>3.0.0.Beta1</version>
2323
</parent>
2424

2525
<modelVersion>4.0.0</modelVersion>

pom.xml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<groupId>org.asynchttpclient</groupId>
2222
<artifactId>async-http-client-project</artifactId>
23-
<version>3.0.0-SNAPSHOT</version>
23+
<version>3.0.0.Beta1</version>
2424
<packaging>pom</packaging>
2525

2626
<name>AHC/Project</name>
@@ -213,6 +213,7 @@
213213
<target>11</target>
214214
</configuration>
215215
</plugin>
216+
216217
<plugin>
217218
<groupId>org.apache.maven.plugins</groupId>
218219
<artifactId>maven-surefire-plugin</artifactId>
@@ -223,6 +224,7 @@
223224
</argLine>
224225
</configuration>
225226
</plugin>
227+
226228
<plugin>
227229
<groupId>org.jacoco</groupId>
228230
<artifactId>jacoco-maven-plugin</artifactId>
@@ -242,6 +244,69 @@
242244
</execution>
243245
</executions>
244246
</plugin>
247+
248+
<plugin>
249+
<groupId>org.apache.maven.plugins</groupId>
250+
<artifactId>maven-source-plugin</artifactId>
251+
<version>3.2.1</version>
252+
<executions>
253+
<execution>
254+
<id>attach-sources</id>
255+
<goals>
256+
<goal>jar-no-fork</goal>
257+
</goals>
258+
</execution>
259+
</executions>
260+
</plugin>
261+
262+
<plugin>
263+
<groupId>org.apache.maven.plugins</groupId>
264+
<artifactId>maven-javadoc-plugin</artifactId>
265+
<version>3.2.0</version>
266+
<executions>
267+
<execution>
268+
<id>attach-javadocs</id>
269+
<goals>
270+
<goal>jar</goal>
271+
</goals>
272+
</execution>
273+
</executions>
274+
</plugin>
275+
276+
<plugin>
277+
<groupId>org.sonatype.plugins</groupId>
278+
<artifactId>nexus-staging-maven-plugin</artifactId>
279+
<version>1.6.8</version>
280+
<extensions>true</extensions>
281+
<configuration>
282+
<serverId>ossrh</serverId>
283+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
284+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
285+
<skipRemoteStaging>false</skipRemoteStaging>
286+
</configuration>
287+
</plugin>
288+
289+
<plugin>
290+
<groupId>org.apache.maven.plugins</groupId>
291+
<artifactId>maven-gpg-plugin</artifactId>
292+
<version>1.6</version>
293+
<executions>
294+
<execution>
295+
<id>sign-artifacts</id>
296+
<phase>verify</phase>
297+
<goals>
298+
<goal>sign</goal>
299+
</goals>
300+
<configuration>
301+
<!-- Prevent gpg from using pinentry programs -->
302+
<gpgArguments>
303+
<arg>--pinentry-mode</arg>
304+
<arg>loopback</arg>
305+
</gpgArguments>
306+
</configuration>
307+
</execution>
308+
</executions>
309+
</plugin>
245310
</plugins>
246311
</build>
247312
</project>

0 commit comments

Comments
 (0)