如何在嵌入式Jetty上设置SSL? [英] How to set up SSL on an embedded Jetty?

查看:90
本文介绍了如何在嵌入式Jetty上设置SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经嵌入了码头7.x.基本上只是创建一个SelectChannelConnector来侦听端口80,并创建WebAppContext来部署单个WAR目录.

I've got jetty 7.x embedded. Basically just creating a SelectChannelConnector to listen on port 80 and WebAppContext to deploy a single WAR directory.

我现在需要添加SSL(所有密钥库的工作都已完成),我猜想只是添加一个SslSelectChannelConnector,但是不推荐使用所有方法,而没有任何Javadocs来解释原因以及替代方法.而且Jetty/SSL文档仅显示一些XML,而没有描述如何处理.

I need to add SSL now (all the keystore stuff is done), and I would have guessed to just add an SslSelectChannelConnector, but all the methods are deprecated without any javadocs to explain why, and what to do instead. And the Jetty/SSL docs only show some XML without describing what to do with it.

有人可以在这里为我设置一个Jetty嵌入式实例SSL的切入点吗?我不认为这会很复杂,我只是不知道在当前版本中从哪个类开始.

Can anyone get me the entry point here to setting up SSL an an embedded instance of Jetty? I don't think this will be complicated, I just don't know what class to start with in the current release.

推荐答案

Jetty用户电子邮件组的答复:

A response from the Jetty Users Email Group:

大卫

您需要创建一个实例 SslContextFactory并配置它 与您的密钥库参数.后 您需要通过该实例 到SslSelectChannelConnector的 构造函数.最近修改 配置文件jetty-ssl.xml显示 在XmlConfiguration中是如何完成的, 可以很容易地翻译成 代码.这将在Jetty中记录 只要有机会,就可以使用Wiki.

You need to create an instance of SslContextFactory and configure it with your keystore parameters. After that you'll need to pass that instance to the SslSelectChannelConnector's constructor. Recently modified configuration file jetty-ssl.xml shows how it is done in XmlConfiguration, and could be easily translated into code. This will be documented in Jetty Wiki as soon as we get a chance.

-迈克尔

这篇关于如何在嵌入式Jetty上设置SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆