Skip to content

Commit

Permalink
Merge pull request #158 from rwth-acis/hotfix/http2
Browse files Browse the repository at this point in the history
Hotfix/http2
  • Loading branch information
AlexanderNeumann authored Sep 15, 2022
2 parents e4749bf + 1afd137 commit f0b8b95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions webconnector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit f0b8b95

Please sign in to comment.