Jetty SSL配置Apache karaf

Sri*_*gar 2 ssl jetty apache-karaf jetty-8

我正在尝试配置jetty以在Apache Karaf OSGI容器中使用SSL.http有效,但https不起作用.可能是什么问题呢?

我的配置详情如下:

等/的jetty.xml

<Call name="addConnector">
    <Arg>
        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host">
                <Property name="jetty.host" />
            </Set>
            <Set name="port">
                <Property name="jetty.port" default="8282" />
            </Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
            <Set name="lowResourcesConnections">20000</Set>
            <Set name="lowResourcesMaxIdleTime">5000</Set>
        </New>
    </Arg>
</Call>
<Call name="addConnector">
 <Arg>
   <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
     <Arg>
       <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
         <Set name="KeyStore">/opt/keystore</Set>
    <Set name="KeyStorePassword">password</Set>
    <Set name="KeyManagerPassword">password</Set>
    <Set name="TrustStore">/opt/keystore</Set>
    <Set name="TrustStorePassword">password</Set>
       </New>
     </Arg>
     <Set name="port">8443</Set>
     <Set name="maxIdleTime">30000</Set>
   </New>
 </Arg>
Run Code Online (Sandbox Code Playgroud)

在/etc/org.ops4j.pax.web.cfg文件中输入

org.ops4j.pax.web.config.file=${karaf.home}/etc/jetty.xml
Run Code Online (Sandbox Code Playgroud)

Ach*_*eck 7

要启用SSL,您只需使用httpService配置启用它.对于此编辑etc/org.ops4j.pax.web.cfg并添加/更改以下条目.

org.osgi.service.http.secure.enabled=true
Run Code Online (Sandbox Code Playgroud)

有关如何配置Pax Web和httpService的更多详细信息可以在官方dokumentation集成测试中找到