Skip to content

Instantly share code, notes, and snippets.

@alexcheng1982
Created December 12, 2017 16:50
Show Gist options
  • Save alexcheng1982/a3ec57b20f393874b005fce6bc194f4e to your computer and use it in GitHub Desktop.
Save alexcheng1982/a3ec57b20f393874b005fce6bc194f4e to your computer and use it in GitHub Desktop.
Jetty Https Connector
final SslContextFactory sslContextFactory = new SslContextFactory(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
final HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
final ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfiguration));
httpsConnector.setPort(httpsPort);
server.addConnector(httpsConnector);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment