Programmatically Configure SSL for Jetty 9 embedded

The ServerConnector should be setup with an SslContextFactory.

The rest of the work you are doing in the HttpConfiguration is irrelevant to setting up SSL.

A good example of setting up SSL in embedded mode is maintained in the embedded jetty examples project.
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java

Edit: to be more clear (thanks Erik)

Update: June 2016

The Eclipse Jetty Project has moved its canonical repository to github.

The above LikeJettyXml.java can now be found at

https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java

Leave a Comment