use of org.glassfish.grizzly.spdy.SpdyAddOn in project narayana by jbosstm.
the class SpdyEnabledHttpServer method addSpdy.
private static void addSpdy(HttpServer server) {
NetworkListener listener = server.getListener("grizzly");
SpdyAddOn spdyAddOn = new SpdyAddOn(SpdyMode.NPN);
listener.registerAddOn(spdyAddOn);
}
use of org.glassfish.grizzly.spdy.SpdyAddOn in project narayana by jbosstm.
the class SpdyEnabledHttpServer method createHttpServer.
private static HttpServer createHttpServer(final URI uri, final GrizzlyHttpContainer handler, final boolean secure, final SSLEngineConfigurator sslEngineConfigurator, final int poolSize, final boolean enableSpdy) throws ProcessingException {
final String host = (uri.getHost() == null) ? NetworkListener.DEFAULT_NETWORK_HOST : uri.getHost();
final int port = (uri.getPort() == -1) ? 80 : uri.getPort();
final HttpServer server = new HttpServer();
final NetworkListener listener = new NetworkListener("grizzly", host, port);
listener.setSecure(secure);
if (sslEngineConfigurator != null) {
listener.setSSLEngineConfig(sslEngineConfigurator);
}
if (poolSize > 0) {
TCPNIOTransport transport = listener.getTransport();
transport.getKernelThreadPoolConfig().setMaxPoolSize(poolSize);
}
if (enableSpdy) {
SpdyAddOn spdyAddOn = new SpdyAddOn(SpdyMode.NPN);
System.out.printf("SPDY: max conc. streams: %d%n", spdyAddOn.getMaxConcurrentStreams());
listener.registerAddOn(spdyAddOn);
}
listener.setSecure(secure);
server.addListener(listener);
// Map the path to the processor.
final ServerConfiguration config = server.getServerConfiguration();
if (handler != null) {
config.addHttpHandler(handler, uri.getPath());
}
config.setPassTraceRequest(true);
try {
// Start the server.
server.start();
} catch (IOException ex) {
throw new ProcessingException("IOException thrown when trying to start grizzly server", ex);
}
return server;
}
Aggregations