Skip to content

Commit 1379ba5

Browse files
committed
Very early changes for SPDY/3 support with the Grizzly provider. More changes pending.
1 parent 63d6cac commit 1379ba5

File tree

4 files changed

+352
-80
lines changed

4 files changed

+352
-80
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public class AsyncHttpClientConfig {
110110
protected boolean strict302Handling;
111111
protected int maxConnectionLifeTimeInMs;
112112
protected boolean useRelativeURIsWithSSLProxies;
113+
protected boolean spdyEnabled;
113114

114115
protected AsyncHttpClientConfig() {
115116
}
@@ -145,7 +146,8 @@ private AsyncHttpClientConfig(int maxTotalConnections,
145146
HostnameVerifier hostnameVerifier,
146147
int ioThreadMultiplier,
147148
boolean strict302Handling,
148-
boolean useRelativeURIsWithSSLProxies) {
149+
boolean useRelativeURIsWithSSLProxies,
150+
boolean spdyEnabled) {
149151

150152
this.maxTotalConnections = maxTotalConnections;
151153
this.maxConnectionPerHost = maxConnectionPerHost;
@@ -185,6 +187,7 @@ private AsyncHttpClientConfig(int maxTotalConnections,
185187
}
186188
this.proxyServer = proxyServer;
187189
this.useRawUrl = useRawUrl;
190+
this.spdyEnabled = spdyEnabled;
188191
}
189192

190193
/**
@@ -455,6 +458,13 @@ public boolean isUseRawUrl() {
455458
return useRawUrl;
456459
}
457460

461+
/**
462+
* @return whether or not SPDY is enabled.
463+
*/
464+
public boolean isSpdyEnabled() {
465+
return spdyEnabled;
466+
}
467+
458468
/**
459469
* Return true if the query parameters will be stripped from the request when a redirect is requested.
460470
*
@@ -575,6 +585,7 @@ public Thread newThread(Runnable r) {
575585
private HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
576586
private int ioThreadMultiplier = 2;
577587
private boolean strict302Handling;
588+
private boolean spdyEnabled;
578589

579590
public Builder() {
580591
}
@@ -1031,6 +1042,21 @@ public Builder setUseRelativeURIsWithSSLProxies(boolean useRelativeURIsWithSSLPr
10311042
return this;
10321043
}
10331044

1045+
/**
1046+
* Enables SPDY support. Note that doing so, will currently disable WebSocket support
1047+
* for this client instance. If not explicitly enabled, spdy will not be used.
1048+
*
1049+
* @param spdyEnabled configures spdy support.
1050+
*
1051+
* @return this
1052+
*
1053+
* @since 2.0
1054+
*/
1055+
public Builder setSpdyEnabled(boolean spdyEnabled) {
1056+
this.spdyEnabled = spdyEnabled;
1057+
return this;
1058+
}
1059+
10341060
/**
10351061
* Create a config builder with values taken from the given prototype configuration.
10361062
*
@@ -1124,7 +1150,8 @@ public AsyncHttpClientConfig build() {
11241150
hostnameVerifier,
11251151
ioThreadMultiplier,
11261152
strict302Handling,
1127-
useRelativeURIsWithSSLProxies);
1153+
useRelativeURIsWithSSLProxies,
1154+
spdyEnabled);
11281155
}
11291156
}
11301157
}

providers/grizzly/pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,26 @@
1313
The Async Http Client Grizzly Provider.
1414
</description>
1515

16+
<properties>
17+
<grizzly.version>2.3.3-SNAPSHOT</grizzly.version>
18+
<grizzly.npn.version>1.0</grizzly.npn.version>
19+
</properties>
20+
1621
<dependencies>
1722
<dependency>
1823
<groupId>org.glassfish.grizzly</groupId>
1924
<artifactId>grizzly-websockets</artifactId>
20-
<version>2.3.2</version>
25+
<version>${grizzly.version}</version>
2126
</dependency>
2227
<dependency>
23-
<groupId>com.ning</groupId>
24-
<artifactId>async-http-client-api</artifactId>
25-
<version>${project.version}</version>
26-
<scope>test</scope>
27-
<classifier>tests</classifier>
28+
<groupId>org.glassfish.grizzly</groupId>
29+
<artifactId>grizzly-spdy</artifactId>
30+
<version>${grizzly.version}</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.glassfish.grizzly</groupId>
34+
<artifactId>grizzly-npn-api</artifactId>
35+
<version>${grizzly.npn.version}</version>
2836
</dependency>
2937
</dependencies>
3038

0 commit comments

Comments
 (0)