Deprecated Jetty SslConnector Methods

SslConnector.java interface has been changed in the newest Jetty 7.3.1.v20110307.

Almost all methods are deprecated without mentioning the replacement interface or methods to use.

I checked jetty-users and jetty-dev mailing lists for no luck information.

Is there anyone who knows how the code should change for the future?

Thanks in advance!

+4
source share
2 answers

Well, digging out the subversion change log for the corresponding commits (crazy), it SslContextFactory out that SslContextFactory should be used.

Example:

 final SslContextFactory sslContextFactory = new SslContextFactory(sKeyStore); sslContextFactory.setKeyStorePassword(sPassword); final SslSocketConnector conn = new SslSocketConnector(sslContextFactory); conn.setReuseAddress(true); // ... 
+6
source

Based on own answer:

 Server server = new Server(); // Encrypt the connection using a valid certificate/keystore SslContextFactory sslContextFactory = new SslContextFactory("path/keystore.jks"); sslContextFactory.setKeyStorePassword("password"); // Create a new SocketConnector at port 443, which is the default port for // HTTPS web pages (no port number needs to be specified in the browser). SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory); sslConnector.setPort(443); // Add the SocketConnector to the server server.setConnectors(new Connector[] {sslConnector}); 
+1
source

Source: https://habr.com/ru/post/1342639/


All Articles