首页 > 代码库 > jetty启动https

jetty启动https

<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector -->
  
  <New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory">
    <Set name="KeyStore">C:/Users/admin/test.keystore</Set>
    <Set name="KeyStorePassword">testtest</Set>
    <Set name="KeyManagerPassword">testtest</Set>
    <Set name="TrustStore">C:/Users/admin/test.keystore</Set>
    <Set name="TrustStorePassword">testtest</Set>
  </New>

  <Call name="addConnector">
    <Arg>
      <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
        <Arg><Ref id="sslContextFactory" /></Arg>
        <Set name="Port">8443</Set>
        <Set name="maxIdleTime">30000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="AcceptQueueSize">100</Set>
      </New>
    </Arg>
  </Call>
</Configure>

修改jetty-ssl.xml,如上

证书生成参考:http://ln-ydc.iteye.com/blog/1335213

 

jetty启动https