我们在camel-jetty中使用https时遇到问题。一旦密钥存储文件被更改(如删除或添加证书),我们如何才能使更改生效?似乎默认情况下,camel-jetty 不会动态重新加载更改。
示例代码:
JettyHttpComponent jettyComponent = getContext().getComponent("jetty", JettyHttpComponent.class);
SslSelectChannelConnector sslConnector = new SslSelectChannelConnector();
SslContextFactory sslFactory = sslConnector.getSslContextFactory();
sslFactory.setNeedClientAuth(true);
sslFactory.setKeyStore("d:" + File.separator +"serverkeystore");
sslFactory.setKeyManagerPassword("serverkey");
sslFactory.setKeyStorePassword("serverkeystore");
sslFactory.setTrustStore("d:" + File.separator +"servertruststore");
sslFactory.setTrustStorePassword("servertruststore");
Map<Integer, SslSelectChannelConnector> connectors = new HashMap<Integer, SslSelectChannelConnector>();
connectors.put(443, sslConnector);
jettyComponent.setSslSocketConnectors(connectors);
from("jetty:https://0.0.0.0/httpsservice")
.id("httpsserver")
.process(new Processor(){
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("OK");
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 200);
}
});
但是当我们动态更改密钥存储文件时,除非重新启动应用程序,否则更改不会生效。有什么方法可以使更改生效吗?
谢谢