This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.3.x-fixes by this push:
new 53e7a65 [CXF-8251]introduce a new property in http-undertow transport
so that can enable http/2 if necessary
53e7a65 is described below
commit 53e7a65df5811c5b36c2dd9a332b6fc775dd1dd8
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
(cherry picked from commit 4ee3180e553dcb395a5421800bf50d2014f04cb9)
---
.../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 856b8c2..d1666a8 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
@@ -68,6 +68,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);
@@ -199,6 +201,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();
@@ -297,6 +302,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) {