Programmatically Configure SSL for Jetty 9 embedded

前端 未结 3 1307
时光说笑
时光说笑 2020-12-01 01:30

I\'m using jetty version 9.0.0.M4 and am trying to configure it to accept SSL connections. following the instructions in: http://www.eclipse.org/jetty/documentation/current/

相关标签:
3条回答
  • 2020-12-01 01:59

    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

    0 讨论(0)
  • 2020-12-01 02:00

    For Jetty 9 there is a good reference here and all you need to do is to create the JKS keystore file as explained here. using the command keytool -genkey -alias sitename -keyalg RSA -keystore keystore.jks -keysize 2048. For some reason what works with jetty 8 is not what works on 9.

    0 讨论(0)
  • 2020-12-01 02:09

    For those who can't get above configuration working: If you are using java 1.7, ensure you have latest update of it. First versions of jvm 1.7 cause problems with accessing https web pages (browser may display: connection reset, connection aborted, or no data received error).

    0 讨论(0)
提交回复
热议问题