Jetty SslConnector's deprecated methods

后端 未结 2 1513
名媛妹妹
名媛妹妹 2021-01-13 15:17

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

Almost all off the methods have been marked as deprecated without mentioni

相关标签:
2条回答
  • 2021-01-13 15:30

    Building on your 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});
    
    0 讨论(0)
  • 2021-01-13 15:40

    Okay, digging out from the subversion changelog for the corresponding commits (crazy) it came 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);
    // ...
    
    0 讨论(0)
提交回复
热议问题