-
Documentation
-
Resolution: Won't Do
-
Major
-
None
-
1.2.11.Final
-
None
Tried to make http2 work, but chrome tool reports my website is not using http2.
My website is running both at port 80/443 with self signed certificate which is added to system trusted store. Chrome is not reporting cert error.
I was checking the chrome tool at chrome://net-internals/#http2 , my url doesn't show up.
Please see my code and let me know what needs to be done to enable http2?
My code:
KeyStore keystore = KeyStore.getInstance("JKS");
char[] ks_pwd = "password".toCharArray();
keystore.load(new FileInputStream(System.getProperty("user.dir") + "/ssl/identity.jks"), ks_pwd);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keystore, ks_pwd);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(keystore);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
Undertow server = Undertow.builder()
.setServerOption(UndertowOptions.ENABLE_HTTP2, true)
.setServerOption(UndertowOptions.ENABLE_SPDY, true)
.addHttpListener(80, "localhost")
.addHttpsListener(443, "localhost", sslContext)
.setHandler(
path().addExactPath("/", h ->
)
.addPrefixPath("/r", resource(new FileResourceManager(new File(System.getProperty("user.dir") + "/fe"), 100)).setDirectoryListingEnabled(true))
.addPrefixPath("/omniws", new WebSocketHandshakeHandler(new WebSocketConnectionCallback() {
@Override
public void onConnect(WebSocketHttpExchange exchange, WebSocketChannel channel) {
channel.getReceiveSetter().set(new AbstractReceiveListener() {
@Override
protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage message)
@Override
protected void onCloseMessage(CloseMessage cm, WebSocketChannel channel)
});
channel.resumeReceives();
}
}))
).build();
server.start();
- relates to
-
UNDERTOW-564 error running http2 example
- Resolved