From b47fecaeb8e9443aca99e90483c05e4def2d000a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 16 Sep 2022 01:08:30 +0200 Subject: [PATCH 1/2] add addon also for https --- .../connectors/webConnector/WebConnector.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/webconnector/src/main/java/i5/las2peer/connectors/webConnector/WebConnector.java b/webconnector/src/main/java/i5/las2peer/connectors/webConnector/WebConnector.java index 9426b44b..9184f626 100644 --- a/webconnector/src/main/java/i5/las2peer/connectors/webConnector/WebConnector.java +++ b/webconnector/src/main/java/i5/las2peer/connectors/webConnector/WebConnector.java @@ -423,19 +423,18 @@ public void start(Node node) throws ConnectorException { private void startHttpServer(ResourceConfig config) throws Exception { http = GrizzlyHttpServerFactory.createHttpServer(new URI("http://0.0.0.0:"+ httpPort + "/"), config, false); - - final TCPNIOTransport transport = http.getListener("grizzly").getTransport(); - transport.setWorkerThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(maxThreads).setMaxPoolSize(maxThreads)); - + NetworkListener listener = http.getListener("grizzly"); // Create default HTTP/2 configuration and provide it to the AddOn Http2Configuration configuration = Http2Configuration.builder().build(); Http2AddOn http2Addon = new Http2AddOn(configuration); // Register the Addon. - http.getListener("grizzly").registerAddOn(http2Addon); - + listener.registerAddOn(http2Addon); + final TCPNIOTransport transport = listener.getTransport(); + transport.setWorkerThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(maxThreads).setMaxPoolSize(maxThreads)); + http.start(); - httpPort = http.getListener("grizzly").getPort(); + httpPort = listener.getPort(); logMessage("Web-Connector in HTTP mode running at " + getHttpEndpoint()); } @@ -469,10 +468,17 @@ private void startHttpsServer(ResourceConfig config) throws Exception { https = GrizzlyHttpServerFactory.createHttpServer(new URI("https://0.0.0.0:"+ httpsPort + "/"), config, sslContext); - final TCPNIOTransport httpsTransport = https.getListener("grizzly").getTransport(); - httpsPort = https.getListener("grizzly").getPort(); + NetworkListener listener = https.getListener("grizzly"); + // Create default HTTP/2 configuration and provide it to the AddOn + Http2Configuration configuration = Http2Configuration.builder().build(); + Http2AddOn http2Addon = new Http2AddOn(configuration); + + // Register the Addon. + listener.registerAddOn(http2Addon); + final TCPNIOTransport httpsTransport = listener.getTransport(); httpsTransport.setWorkerThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(maxThreads).setMaxPoolSize(maxThreads)); https.start(); + httpsPort = listener.getPort(); logMessage("Web-Connector in HTTPS mode running at " + getHttpsEndpoint()); } From 1afd137a2e0e0004b80b06840b8ce98cb5283925 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 16 Sep 2022 01:24:58 +0200 Subject: [PATCH 2/2] Update build.gradle --- webconnector/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webconnector/build.gradle b/webconnector/build.gradle index 1616c997..1a11f057 100644 --- a/webconnector/build.gradle +++ b/webconnector/build.gradle @@ -71,9 +71,9 @@ dependencies { implementation "org.webjars:swagger-ui:3.6.1" implementation "javax.xml.bind:jaxb-api:2.3.1" implementation "org.glassfish.jersey.inject:jersey-hk2:${project.property('jersey.version')}" - implementation "org.glassfish.grizzly:grizzly-http2:2.3.30" - implementation "org.glassfish.grizzly:grizzly-npn-api:1.8" - implementation "org.glassfish.grizzly:grizzly-npn-bootstrap:1.8.1" + implementation "org.glassfish.grizzly:grizzly-http2:2.4.4" + implementation "org.glassfish.grizzly:grizzly-npn-api:2.0.0" + implementation "org.glassfish.grizzly:grizzly-npn-bootstrap:2.0.0" } // put all .jar files into export/jars folder