Skip to content

Commit 163a433

Browse files
committed
Fix merge
2 parents c3651ee + 4d2ab70 commit 163a433

20 files changed

+485
-110
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ nbproject
1616
target
1717
test-output
1818
/META-INF/MANIFEST.MF
19+
work

pom.xml

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<parent>
45
<groupId>org.sonatype.oss</groupId>
56
<artifactId>oss-parent</artifactId>
@@ -9,7 +10,7 @@
910
<groupId>com.ning</groupId>
1011
<artifactId>async-http-client</artifactId>
1112
<name>Asynchronous Http Client</name>
12-
<version>1.6.4-SNAPSHOT</version>
13+
<version>1.7.0-SNAPSHOT</version>
1314
<packaging>jar</packaging>
1415
<description>
1516
Async Http Client library purpose is to allow Java applications to easily execute HTTP requests and
@@ -151,18 +152,18 @@
151152
</exclusions>
152153
</dependency>
153154

154-
<dependency>
155-
<groupId>commons-io</groupId>
156-
<artifactId>commons-io</artifactId>
157-
<version>2.0.1</version>
158-
<scope>test</scope>
159-
</dependency>
160-
<dependency>
161-
<groupId>commons-fileupload</groupId>
162-
<artifactId>commons-fileupload</artifactId>
163-
<version>1.2.2</version>
164-
<scope>test</scope>
165-
</dependency>
155+
<dependency>
156+
<groupId>commons-io</groupId>
157+
<artifactId>commons-io</artifactId>
158+
<version>2.0.1</version>
159+
<scope>test</scope>
160+
</dependency>
161+
<dependency>
162+
<groupId>commons-fileupload</groupId>
163+
<artifactId>commons-fileupload</artifactId>
164+
<version>1.2.2</version>
165+
<scope>test</scope>
166+
</dependency>
166167

167168
<!-- Optional Apache Http Client -->
168169
<dependency>
@@ -195,6 +196,14 @@
195196
</extensions>
196197
<defaultGoal>install</defaultGoal>
197198
<plugins>
199+
<plugin>
200+
<groupId>org.apache.maven.plugins</groupId>
201+
<artifactId>maven-surefire-plugin</artifactId>
202+
<version>2.8.1</version>
203+
<configuration>
204+
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
205+
</configuration>
206+
</plugin>
198207
<plugin>
199208
<groupId>org.codehaus.mojo</groupId>
200209
<artifactId>animal-sniffer-maven-plugin</artifactId>
@@ -364,9 +373,12 @@
364373
</excludes>
365374
</artifactSet>
366375
<transformers>
367-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
368-
<transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
369-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
376+
<transformer
377+
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
378+
<transformer
379+
implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/>
380+
<transformer
381+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
370382
</transformers>
371383
</configuration>
372384
</execution>
@@ -378,12 +390,16 @@
378390
<version>2.3</version>
379391
<configuration>
380392
<excludes>
381-
<exclude>**/NettyAsyncHttpProvider$*</exclude>
393+
<exclude>**/NettyAsyncHttpProvider$*</exclude>
382394
<exclude>**/AsyncHandler$STATE</exclude>
383395
<exclude>**/ProxyServer$Protocol</exclude>
384396
<exclude>**/Realm$AuthScheme</exclude>
385397
<exclude>**/SimpleAsyncHttpClient$ErrorDocumentBehaviour</exclude>
386-
<exclude>**/SpnegoEngine</exclude>
398+
<exclude>**/SpnegoEngine</exclude>
399+
<exclude>**/Request</exclude>
400+
<exclude>**/Request$EntityWriter</exclude>
401+
<exclude>**/RequestBuilderBase</exclude>
402+
<exclude>**/Response</exclude>
387403
</excludes>
388404
</configuration>
389405
<executions>
@@ -434,6 +450,7 @@
434450
<artifactId>maven-surefire-plugin</artifactId>
435451
<configuration>
436452
<groups>standalone</groups>
453+
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
437454
</configuration>
438455
</plugin>
439456
</plugins>
@@ -448,11 +465,18 @@
448465
<artifactId>maven-surefire-plugin</artifactId>
449466
<configuration>
450467
<groups>standalone, online</groups>
468+
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
451469
</configuration>
452470
</plugin>
453471
</plugins>
454472
</build>
455473
</profile>
474+
<profile>
475+
<id>test-output</id>
476+
<properties>
477+
<surefire.redirectTestOutputToFile>false</surefire.redirectTestOutputToFile>
478+
</properties>
479+
</profile>
456480
</profiles>
457481
<distributionManagement>
458482
<repository>
@@ -477,6 +501,7 @@
477501
</repositories>
478502
<properties>
479503
<distMgmtSnapshotsUrl>http://oss.sonatype.org/content/repositories/snapshots</distMgmtSnapshotsUrl>
504+
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
480505
</properties>
481506
</project>
482507

src/main/java/com/ning/http/client/AsyncHttpClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ public class BoundRequestBuilder extends RequestBuilderBase<BoundRequestBuilder>
215215
*/
216216
protected String baseURL;
217217

218-
private BoundRequestBuilder(String reqType) {
219-
super(BoundRequestBuilder.class, reqType);
218+
private BoundRequestBuilder(String reqType, boolean useRawUrl) {
219+
super(BoundRequestBuilder.class, reqType, useRawUrl);
220220
}
221221

222222
private BoundRequestBuilder(Request prototype) {
@@ -557,7 +557,7 @@ private final static AsyncHttpProvider loadDefaultProvider(String className, Asy
557557
}
558558

559559
protected BoundRequestBuilder requestBuilder(String reqType, String url) {
560-
return new BoundRequestBuilder(reqType).setUrl(url).setSignatureCalculator(signatureCalculator);
560+
return new BoundRequestBuilder(reqType, config.isUseRawUrl()).setUrl(url).setSignatureCalculator(signatureCalculator);
561561
}
562562

563563
protected BoundRequestBuilder requestBuilder(Request prototype) {

src/main/java/com/ning/http/client/AsyncHttpClientConfig.java

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,39 @@
5151
*/
5252
public class AsyncHttpClientConfig {
5353

54-
private final static String ASYNC_CLIENT = AsyncHttpClientConfig.class.getName() + ".";
55-
56-
private final int maxTotalConnections;
57-
private final int maxConnectionPerHost;
58-
private final int connectionTimeOutInMs;
59-
private final int idleConnectionInPoolTimeoutInMs;
60-
private final int requestTimeoutInMs;
61-
private final boolean redirectEnabled;
62-
private final int maxDefaultRedirects;
63-
private final boolean compressionEnabled;
64-
private final String userAgent;
65-
private final boolean allowPoolingConnection;
66-
private final ScheduledExecutorService reaper;
67-
private final ExecutorService applicationThreadPool;
68-
private final ProxyServer proxyServer;
69-
private final SSLContext sslContext;
70-
private final SSLEngineFactory sslEngineFactory;
71-
private final AsyncHttpProviderConfig<?, ?> providerConfig;
72-
private final ConnectionsPool<?, ?> connectionsPool;
73-
private final Realm realm;
74-
private final List<RequestFilter> requestFilters;
75-
private final List<ResponseFilter> responseFilters;
76-
private final List<IOExceptionFilter> ioExceptionFilters;
77-
private final int requestCompressionLevel;
78-
private final int maxRequestRetry;
79-
private final boolean allowSslConnectionPool;
80-
private final boolean useRawUrl;
81-
private final boolean removeQueryParamOnRedirect;
82-
private final HostnameVerifier hostnameVerifier;
83-
private final int ioThreadMultiplier;
54+
protected final static String ASYNC_CLIENT = AsyncHttpClientConfig.class.getName() + ".";
55+
56+
protected int maxTotalConnections;
57+
protected int maxConnectionPerHost;
58+
protected int connectionTimeOutInMs;
59+
protected int idleConnectionInPoolTimeoutInMs;
60+
protected int requestTimeoutInMs;
61+
protected boolean redirectEnabled;
62+
protected int maxDefaultRedirects;
63+
protected boolean compressionEnabled;
64+
protected String userAgent;
65+
protected boolean allowPoolingConnection;
66+
protected ScheduledExecutorService reaper;
67+
protected ExecutorService applicationThreadPool;
68+
protected ProxyServer proxyServer;
69+
protected SSLContext sslContext;
70+
protected SSLEngineFactory sslEngineFactory;
71+
protected AsyncHttpProviderConfig<?, ?> providerConfig;
72+
protected ConnectionsPool<?, ?> connectionsPool;
73+
protected Realm realm;
74+
protected List<RequestFilter> requestFilters;
75+
protected List<ResponseFilter> responseFilters;
76+
protected List<IOExceptionFilter> ioExceptionFilters;
77+
protected int requestCompressionLevel;
78+
protected int maxRequestRetry;
79+
protected boolean allowSslConnectionPool;
80+
protected boolean useRawUrl;
81+
protected boolean removeQueryParamOnRedirect;
82+
protected HostnameVerifier hostnameVerifier;
83+
protected int ioThreadMultiplier;
84+
85+
protected AsyncHttpClientConfig(){
86+
}
8487

8588
private AsyncHttpClientConfig(int maxTotalConnections,
8689
int maxConnectionPerHost,
@@ -902,7 +905,6 @@ public Builder(AsyncHttpClientConfig prototype) {
902905
connectionsPool = prototype.getConnectionsPool();
903906
defaultConnectionTimeOutInMs = prototype.getConnectionTimeoutInMs();
904907
defaultIdleConnectionInPoolTimeoutInMs = prototype.getIdleConnectionInPoolTimeoutInMs();
905-
allowPoolingConnection = prototype.getKeepAlive();
906908
defaultMaxConnectionPerHost = prototype.getMaxConnectionPerHost();
907909
maxDefaultRedirects = prototype.getMaxRedirects();
908910
defaultMaxTotalConnections = prototype.getMaxTotalConnections();
@@ -912,14 +914,26 @@ public Builder(AsyncHttpClientConfig prototype) {
912914
sslContext = prototype.getSSLContext();
913915
sslEngineFactory = prototype.getSSLEngineFactory();
914916
userAgent = prototype.getUserAgent();
917+
redirectEnabled = prototype.isRedirectEnabled();
918+
compressionEnabled = prototype.isCompressionEnabled();
919+
reaper = prototype.reaper();
920+
applicationThreadPool = prototype.executorService();
915921

916922
requestFilters.clear();
917923
responseFilters.clear();
924+
ioExceptionFilters.clear();
918925

919926
requestFilters.addAll(prototype.getRequestFilters());
920927
responseFilters.addAll(prototype.getResponseFilters());
928+
ioExceptionFilters.addAll(prototype.getIOExceptionFilters());
929+
930+
requestCompressionLevel = prototype.getRequestCompressionLevel();
921931
useRawUrl = prototype.isUseRawUrl();
922932
ioThreadMultiplier = prototype.getIoThreadMultiplier();
933+
maxRequestRetry = prototype.getMaxRequestRetry();
934+
allowSslConnectionPool = prototype.getAllowPoolingConnection();
935+
removeQueryParamOnRedirect = prototype.isRemoveQueryParamOnRedirect();
936+
hostnameVerifier = prototype.getHostnameVerifier();
923937
}
924938

925939
/**

0 commit comments

Comments
 (0)