Jetty SslConnector 已弃用的方法

发布于 2024-10-20 19:36:44 字数 550 浏览 2 评论 0原文

SslConnector.java<最新的 Jetty 7.3.1.v20110307 中的 /code>界面已更改。

几乎所有方法都已被标记为已弃用,而没有提及要使用的替换接口或方法。

我检查了 jetty-users 和 < href="https://dev.eclipse.org/mailman/listinfo/jetty-dev" rel="nofollow">jetty-dev 邮件列表获取信息,但运气不佳。

有谁知道将来应该如何更改代码吗?

提前致谢!

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 mentioning the replacement interface or methods to use.

I've checked the jetty-users and jetty-dev mailing lists for the information with no luck.

Is there anybody out there who knows how should be the code changed for the future?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情定在深秋 2024-10-27 19:36:44

好吧,从颠覆变更日志中挖掘出相应的提交(疯狂),结果是 SslContextFactory 应该使用。

示例:

final SslContextFactory sslContextFactory = new SslContextFactory(sKeyStore);
sslContextFactory.setKeyStorePassword(sPassword);

final SslSocketConnector conn = new SslSocketConnector(sslContextFactory);
conn.setReuseAddress(true);
// ...

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);
// ...
游魂 2024-10-27 19:36:44

根据您自己的答案:

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});

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});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文