This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 4ee3180 [CXF-8251]introduce a new property in http-undertow transport
so that can enable http/2 if necessary
4ee3180 is described below
commit 4ee3180e553dcb395a5421800bf50d2014f04cb9
Author: Freeman Fang <[email protected]>
AuthorDate: Thu Mar 26 16:38:38 2020 -0400
[CXF-8251]introduce a new property in http-undertow transport so that can
enable http/2 if necessary
---
.../http_undertow/UndertowHTTPServerEngine.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
index 4750780..c697f9d 100644
---
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
+++
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPServerEngine.java
@@ -67,6 +67,8 @@ import io.undertow.util.CopyOnWriteMap;
public class UndertowHTTPServerEngine implements ServerEngine {
public static final String DO_NOT_CHECK_URL_PROP =
"org.apache.cxf.transports.http_undertow.DontCheckUrl";
+
+ public static final String ENABLE_HTTP2_PROP =
"org.apache.cxf.transports.http_undertow.EnableHttp2";
private static final Logger LOG =
LogUtils.getL7dLogger(UndertowHTTPServerEngine.class);
@@ -198,6 +200,9 @@ public class UndertowHTTPServerEngine implements
ServerEngine {
private Undertow createServer(URL url, UndertowHTTPHandler
undertowHTTPHandler) throws Exception {
Undertow.Builder result = Undertow.builder();
result.setServerOption(UndertowOptions.IDLE_TIMEOUT, getMaxIdleTime());
+ if (this.shouldEnableHttp2(undertowHTTPHandler.getBus())) {
+ result.setServerOption(UndertowOptions.ENABLE_HTTP2, Boolean.TRUE);
+ }
if (tlsServerParameters != null) {
if (this.sslContext == null) {
this.sslContext = createSSLContext();
@@ -296,6 +301,18 @@ public class UndertowHTTPServerEngine implements
ServerEngine {
}
return !PropertyUtils.isTrue(prop);
}
+
+ private boolean shouldEnableHttp2(Bus bus) {
+
+ Object prop = null;
+ if (bus != null) {
+ prop = bus.getProperty(ENABLE_HTTP2_PROP);
+ }
+ if (prop == null) {
+ prop = SystemPropertyAction.getPropertyOrNull(ENABLE_HTTP2_PROP);
+ }
+ return PropertyUtils.isTrue(prop);
+ }
protected void checkRegistedContext(URL url) {