diff --git a/bom/pom.xml b/bom/pom.xml
index fc5eaa809f..0a827f5b12 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -31,7 +31,7 @@
grizzly-bom
pom
grizzly-bom
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
Grizzly Bill of Materials (BOM)
diff --git a/extras/bundles/grizzly-httpservice-bundle/pom.xml b/extras/bundles/grizzly-httpservice-bundle/pom.xml
index 19437313ef..8f56577eb2 100644
--- a/extras/bundles/grizzly-httpservice-bundle/pom.xml
+++ b/extras/bundles/grizzly-httpservice-bundle/pom.xml
@@ -20,13 +20,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
jar
Grizzly OSGi HttpService Bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
org.glassfish.grizzly.osgi
grizzly-httpservice-bundle
diff --git a/extras/bundles/pom.xml b/extras/bundles/pom.xml
index f204356543..05d66f30fe 100644
--- a/extras/bundles/pom.xml
+++ b/extras/bundles/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-extra-bundles
pom
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-extra-bundles
diff --git a/extras/connection-pool/pom.xml b/extras/connection-pool/pom.xml
index 2b391b8dc4..b4b3334b8e 100644
--- a/extras/connection-pool/pom.xml
+++ b/extras/connection-pool/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
connection-pool
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
connection-pool
install
diff --git a/extras/grizzly-httpservice/pom.xml b/extras/grizzly-httpservice/pom.xml
index 08855da78d..aeb7d32cc4 100644
--- a/extras/grizzly-httpservice/pom.xml
+++ b/extras/grizzly-httpservice/pom.xml
@@ -20,14 +20,14 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
jar
Grizzly OSGi HttpService
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
org.glassfish.grizzly.osgi
grizzly-httpservice
diff --git a/extras/http-server-jaxws/pom.xml b/extras/http-server-jaxws/pom.xml
index 3f3a3ee99c..343e647304 100644
--- a/extras/http-server-jaxws/pom.xml
+++ b/extras/http-server-jaxws/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-server-jaxws
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-server-jaxws
install
diff --git a/extras/http-server-multipart/pom.xml b/extras/http-server-multipart/pom.xml
index c5544183d3..1c5479869e 100644
--- a/extras/http-server-multipart/pom.xml
+++ b/extras/http-server-multipart/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-server-multipart
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-server-multipart
install
diff --git a/extras/http-servlet-extras/pom.xml b/extras/http-servlet-extras/pom.xml
index 6674bbbf0b..fb455cfd0f 100644
--- a/extras/http-servlet-extras/pom.xml
+++ b/extras/http-servlet-extras/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-servlet-extras
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-servlet-extras
install
diff --git a/extras/pom.xml b/extras/pom.xml
index e85560d12b..68a730b149 100644
--- a/extras/pom.xml
+++ b/extras/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../pom.xml
4.0.0
grizzly-extras
pom
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-extras
diff --git a/extras/tls-sni/pom.xml b/extras/tls-sni/pom.xml
index 1d6898dac7..049fe72200 100644
--- a/extras/tls-sni/pom.xml
+++ b/extras/tls-sni/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
tls-sni
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
tls-sni
install
diff --git a/modules/bundles/comet/pom.xml b/modules/bundles/comet/pom.xml
index 0a41198a25..275ab7c339 100644
--- a/modules/bundles/comet/pom.xml
+++ b/modules/bundles/comet/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-comet-server
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-comet-server
install
diff --git a/modules/bundles/core/pom.xml b/modules/bundles/core/pom.xml
index b792ca0f1a..7a2591cdc4 100644
--- a/modules/bundles/core/pom.xml
+++ b/modules/bundles/core/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-core
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-core
install
diff --git a/modules/bundles/http-all/pom.xml b/modules/bundles/http-all/pom.xml
index 3369b603c3..c50fe8f9b6 100644
--- a/modules/bundles/http-all/pom.xml
+++ b/modules/bundles/http-all/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-http-all
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-all
install
diff --git a/modules/bundles/http-servlet/pom.xml b/modules/bundles/http-servlet/pom.xml
index 884f08eba1..7db8d0ef2d 100755
--- a/modules/bundles/http-servlet/pom.xml
+++ b/modules/bundles/http-servlet/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-http-servlet-server
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-servlet-server
install
diff --git a/modules/bundles/http/pom.xml b/modules/bundles/http/pom.xml
index aaa51da586..5544e1e6e1 100755
--- a/modules/bundles/http/pom.xml
+++ b/modules/bundles/http/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-http-server-core
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-server-core
install
@@ -171,7 +171,7 @@
org.glassfish.grizzly
grizzly-npn-api
- ${grizzly.alpn.version}
+ ${grizzly.npn.api.version}
org.glassfish.grizzly
diff --git a/modules/bundles/pom.xml b/modules/bundles/pom.xml
index 3fb5bddcc3..789f323b80 100644
--- a/modules/bundles/pom.xml
+++ b/modules/bundles/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-bundles
pom
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-bundles
diff --git a/modules/bundles/websockets/pom.xml b/modules/bundles/websockets/pom.xml
index 4a58056a59..f7f550532c 100644
--- a/modules/bundles/websockets/pom.xml
+++ b/modules/bundles/websockets/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../../pom.xml
4.0.0
grizzly-websockets-server
jar
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-websockets-server
install
diff --git a/modules/comet/pom.xml b/modules/comet/pom.xml
index 39c67ff779..91aad8fefa 100644
--- a/modules/comet/pom.xml
+++ b/modules/comet/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-comet
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-comet
install
diff --git a/modules/grizzly/pom.xml b/modules/grizzly/pom.xml
index aba3318396..bda79af58d 100644
--- a/modules/grizzly/pom.xml
+++ b/modules/grizzly/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-framework
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-framework
install
diff --git a/modules/grizzly/src/main/java/org/glassfish/grizzly/filterchain/DefaultFilterChain.java b/modules/grizzly/src/main/java/org/glassfish/grizzly/filterchain/DefaultFilterChain.java
index 82cb59ae1f..53828ec39c 100644
--- a/modules/grizzly/src/main/java/org/glassfish/grizzly/filterchain/DefaultFilterChain.java
+++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/filterchain/DefaultFilterChain.java
@@ -253,14 +253,14 @@ protected NextAction executeFilter(final FilterExecutor executor,
NextAction nextNextAction;
do {
if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.log(Level.FINE, "Execute filter. filter={0} context={1}",
+ LOGGER.log(Level.FINE, "before filter execution. filter={0} context={1}",
new Object[]{currentFilter, ctx});
}
// execute the task
nextNextAction = executor.execute(currentFilter, ctx);
if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.log(Level.FINE, "after execute filter. filter={0} context={1} nextAction={2}",
+ LOGGER.log(Level.FINE, "after filter execution. filter={0} context={1} nextAction={2}",
new Object[]{currentFilter, ctx, nextNextAction});
}
} while (nextNextAction.type() == RerunFilterAction.TYPE);
diff --git a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/HandshakeListener.java b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/HandshakeListener.java
deleted file mode 100644
index e9d296d26c..0000000000
--- a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/HandshakeListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.glassfish.grizzly.ssl;
-
-import javax.net.ssl.SSLEngine;
-
-import org.glassfish.grizzly.Connection;
-
-public interface HandshakeListener {
- void onInit(Connection> connection, SSLEngine sslEngine);
- void onStart(Connection> connection);
- void onComplete(Connection> connection);
- void onFailure(Connection> connection, Throwable t);
-}
\ No newline at end of file
diff --git a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
index 0267b9e14b..04752020a8 100644
--- a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
+++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLBaseFilter.java
@@ -365,11 +365,9 @@ public NextAction handleWrite(final FilterChainContext ctx) throws IOException {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized(connection) {
- final Buffer output =
- wrapAll(ctx, obtainSslConnectionContext(connection));
+ final Buffer output = wrapAll(ctx, obtainSslConnectionContext(connection));
- final TransportContext transportContext =
- ctx.getTransportContext();
+ final TransportContext transportContext = ctx.getTransportContext();
ctx.write(null, output,
transportContext.getCompletionHandler(),
@@ -909,20 +907,18 @@ public void run() {
}
}
- protected SSLConnectionContext obtainSslConnectionContext(
- final Connection connection) {
+ protected SSLConnectionContext obtainSslConnectionContext( final Connection connection) {
SSLConnectionContext sslCtx = SSL_CTX_ATTR.get(connection);
if (sslCtx == null) {
sslCtx = createSslConnectionContext(connection);
SSL_CTX_ATTR.set(connection, sslCtx);
}
-
+
return sslCtx;
}
-
+
@SuppressWarnings("MethodMayBeStatic")
- protected SSLConnectionContext createSslConnectionContext(
- final Connection connection) {
+ protected SSLConnectionContext createSslConnectionContext( final Connection connection) {
return new SSLConnectionContext(connection);
}
@@ -981,9 +977,7 @@ private static Certificate[] getPeerCertificates(final SSLConnectionContext sslC
try {
return sslCtx.getSslEngine().getSession().getPeerCertificates();
} catch( Throwable t ) {
- if (LOGGER.isLoggable(Level.FINE)) {
- LOGGER.log(Level.FINE,"Error getting client certs", t);
- }
+ LOGGER.log(Level.FINE,"Error getting client certs", t);
return null;
}
}
@@ -1208,4 +1202,15 @@ public Buffer clone(final Connection connection,
return originalMessage;
}
}
+
+
+ // don't move to own file, Tyrus has a dependency on this interface
+ public interface HandshakeListener {
+ default void onInit(Connection> connection, SSLEngine sslEngine) {
+ // nothing
+ }
+ void onStart(Connection> connection);
+ void onComplete(Connection> connection);
+ void onFailure(Connection> connection, Throwable t);
+ }
}
diff --git a/modules/http-ajp/pom.xml b/modules/http-ajp/pom.xml
index 2c6181a05c..0d10cf462c 100755
--- a/modules/http-ajp/pom.xml
+++ b/modules/http-ajp/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-ajp
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-ajp
https://projects.eclipse.org/projects/ee4j.grizzly
diff --git a/modules/http-server/pom.xml b/modules/http-server/pom.xml
index fd288498e6..56ad30a217 100644
--- a/modules/http-server/pom.xml
+++ b/modules/http-server/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-server
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-server
install
diff --git a/modules/http-servlet/pom.xml b/modules/http-servlet/pom.xml
index 64e7c545a9..adb85e5df0 100755
--- a/modules/http-servlet/pom.xml
+++ b/modules/http-servlet/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http-servlet
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http-servlet
install
diff --git a/modules/http/pom.xml b/modules/http/pom.xml
index 01afd55627..9f443f2d87 100644
--- a/modules/http/pom.xml
+++ b/modules/http/pom.xml
@@ -21,13 +21,13 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http
bundle
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
grizzly-http
install
diff --git a/modules/http/src/main/java/org/glassfish/grizzly/http/HttpContent.java b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpContent.java
index dab209a6ea..5e930df3dd 100644
--- a/modules/http/src/main/java/org/glassfish/grizzly/http/HttpContent.java
+++ b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpContent.java
@@ -36,7 +36,7 @@
*/
public class HttpContent extends HttpPacket
implements org.glassfish.grizzly.Appendable {
-
+
private static final ThreadCache.CachedTypeIndex CACHE_IDX =
ThreadCache.obtainIndex(HttpContent.class, 16);
@@ -72,27 +72,25 @@ public static HttpContent create(final HttpHeader httpHeader,
final boolean isLast) {
return create(httpHeader, isLast, Buffers.EMPTY_BUFFER);
}
-
+
public static HttpContent create(final HttpHeader httpHeader,
final boolean isLast, Buffer content) {
content = content != null ? content : Buffers.EMPTY_BUFFER;
-
- final HttpContent httpContent =
- ThreadCache.takeFromCache(CACHE_IDX);
+ final HttpContent httpContent = ThreadCache.takeFromCache(CACHE_IDX);
if (httpContent != null) {
httpContent.httpHeader = httpHeader;
httpContent.isLast = isLast;
httpContent.content = content;
-
+
return httpContent;
}
return new HttpContent(httpHeader, isLast, content);
}
-
+
/**
* Returns {@link HttpContent} builder.
- *
+ *
* @param httpHeader related HTTP message header
* @return {@link Builder}.
*/
@@ -101,7 +99,7 @@ public static Builder builder(final HttpHeader httpHeader) {
}
protected boolean isLast;
-
+
protected Buffer content = Buffers.EMPTY_BUFFER;
protected HttpHeader httpHeader;
@@ -120,7 +118,7 @@ protected HttpContent(final HttpHeader httpHeader, final boolean isLast,
this.isLast = isLast;
this.content = content;
}
-
+
/**
* Get the HTTP message content {@link Buffer}.
*
@@ -147,7 +145,7 @@ public final HttpHeader getHttpHeader() {
/**
* Return true, if the current content chunk is last,
* or false, if there are content chunks to follow.
- *
+ *
* @return true, if the current content chunk is last,
* or false, if there are content chunks to follow.
*/
@@ -176,7 +174,7 @@ public HttpContent append(final HttpContent element) {
if (isBroken(element)) {
return element;
}
-
+
final Buffer content2 = element.getContent();
if (content2 != null && content2.hasRemaining()) {
content = Buffers.appendBuffers(null, content, content2);
@@ -244,7 +242,7 @@ public final T last(boolean last) {
this.last = last;
return (T) this;
}
-
+
/**
* Set the HttpContent chunk content {@link Buffer}.
*
diff --git a/modules/http/src/main/java/org/glassfish/grizzly/http/HttpTrailer.java b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpTrailer.java
index cdcc089ccf..5cec0f863d 100644
--- a/modules/http/src/main/java/org/glassfish/grizzly/http/HttpTrailer.java
+++ b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpTrailer.java
@@ -36,7 +36,7 @@ public class HttpTrailer extends HttpContent implements MimeHeadersPacket {
* @return true if passed {@link HttpContent} is a HttpTrailder.
*/
public static boolean isTrailer(HttpContent httpContent) {
- return HttpTrailer.class.isAssignableFrom(httpContent.getClass());
+ return httpContent != null && HttpTrailer.class.isAssignableFrom(httpContent.getClass());
}
public static HttpTrailer create() {
diff --git a/modules/http2/pom.xml b/modules/http2/pom.xml
index d27ec0ec89..39ee242750 100644
--- a/modules/http2/pom.xml
+++ b/modules/http2/pom.xml
@@ -21,14 +21,16 @@
org.glassfish.grizzly
grizzly-project
- 2.4.4.payara-p4-SNAPSHOT
+ 2.4.4.payara-p4
../../pom.xml
4.0.0
grizzly-http2
- 2.4.4.payara-p4-SNAPSHOT
grizzly-http2
+
+
+
install
@@ -83,9 +85,7 @@
maven-surefire-plugin
-
- -XX:+HeapDumpOnOutOfMemoryError -Xbootclasspath/p:${settings.localRepository}/org/glassfish/grizzly/grizzly-npn-bootstrap/1.8/grizzly-npn-bootstrap-1.8.jar
-
+ -XX:+HeapDumpOnOutOfMemoryError ${bootClasspath}
@@ -118,7 +118,7 @@
org.glassfish.grizzly
grizzly-npn-api
- ${grizzly.alpn.version}
+ ${grizzly.npn.api.version}
provided
@@ -128,6 +128,36 @@
2.18.3
test
-
+
+
+
+ openjsse
+
+ -Xbootclasspath/p:${settings.localRepository}/org/openjsse/openjsse/${openjsse.version}/openjsse-${openjsse.version}.jar
+
+
+
+ org.openjsse
+ openjsse
+ ${openjsse.version}
+ provided
+
+
+
+
+ npn
+
+ -Xbootclasspath/p:${settings.localRepository}/org/glassfish/grizzly/grizzly-npn-bootstrap/${grizzly.npn.bootstrap.version}/grizzly-npn-bootstrap-${grizzly.npn.bootstrap.version}.jar
+
+
+
+ org.glassfish.grizzly
+ grizzly-npn-bootstrap
+ ${grizzly.npn.bootstrap.version}
+ provided
+
+
+
+
diff --git a/modules/http2/src/main/java/org/glassfish/grizzly/http2/AlpnSupport.java b/modules/http2/src/main/java/org/glassfish/grizzly/http2/AlpnSupport.java
index 36862b4986..2752e62bdf 100644
--- a/modules/http2/src/main/java/org/glassfish/grizzly/http2/AlpnSupport.java
+++ b/modules/http2/src/main/java/org/glassfish/grizzly/http2/AlpnSupport.java
@@ -22,7 +22,6 @@
import java.util.WeakHashMap;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.function.BiFunction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -37,43 +36,24 @@
import org.glassfish.grizzly.npn.AlpnClientNegotiator;
import org.glassfish.grizzly.npn.AlpnServerNegotiator;
import org.glassfish.grizzly.npn.NegotiationSupport;
-import org.glassfish.grizzly.ssl.HandshakeListener;
import org.glassfish.grizzly.ssl.SSLBaseFilter;
+import org.glassfish.grizzly.ssl.SSLBaseFilter.HandshakeListener;
import org.glassfish.grizzly.ssl.SSLUtils;
/**
* Grizzly TLS Next Protocol Negotiation support class.
- *
*/
public class AlpnSupport {
- private final static Logger LOGGER = Grizzly.logger(AlpnSupport.class);
+ private static final Logger LOGGER = Grizzly.logger(AlpnSupport.class);
- private final static Map> SSL_TO_CONNECTION_MAP =
- new WeakHashMap<>();
-
+ private static final Map> SSL_TO_CONNECTION_MAP = new WeakHashMap<>();
private static final AlpnSupport INSTANCE;
- private static final Method nativeHandshakeMethod;
-
- static {
- boolean isExtensionFound = false;
- Method setHandshakeAlpnSelector = null;
-
- try {
- setHandshakeAlpnSelector = SSLEngine.class.getMethod("setHandshakeApplicationProtocolSelector", BiFunction.class);
- } catch (Exception e) {
- try {
- ClassLoader.getSystemClassLoader().loadClass("sun.security.ssl.GrizzlyNPN");
- isExtensionFound = true;
- } catch (Exception e2) {
- LOGGER.log(Level.FINE, "Native ALPN is not found:", e);
- LOGGER.log(Level.FINE, "TLS ALPN extension is not found:", e2);
- }
- }
+ private static final AplnExtensionCompatibility COMPATIBILITY;
- nativeHandshakeMethod = setHandshakeAlpnSelector;
- INSTANCE = isExtensionFound
- || nativeHandshakeMethod != null
- ? new AlpnSupport() : null;
+ static {
+ COMPATIBILITY = AplnExtensionCompatibility.getInstance();
+ LOGGER.config(() -> "Detected ALPN compatibility info: " + COMPATIBILITY);
+ INSTANCE = COMPATIBILITY.isAlpnExtensionAvailable() ? new AlpnSupport() : null;
}
public static boolean isEnabled() {
@@ -84,7 +64,6 @@ public static AlpnSupport getInstance() {
if (!isEnabled()) {
throw new IllegalStateException("TLS ALPN is disabled");
}
-
return INSTANCE;
}
@@ -93,39 +72,42 @@ public static Connection> getConnection(final SSLEngine engine) {
return SSL_TO_CONNECTION_MAP.get(engine);
}
}
-
- private static void setConnection(final SSLEngine engine,
- final Connection> connection) {
+
+ private static void setConnection(final SSLEngine engine, final Connection> connection) {
synchronized (SSL_TO_CONNECTION_MAP) {
SSL_TO_CONNECTION_MAP.put(engine, connection);
}
}
- private final Map