类org.springframework.boot.context.embedded.Ssl源码实例Demo

下面列出了怎么用org.springframework.boot.context.embedded.Ssl的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: youkefu   文件: WebServerConfiguration.java
@Bean  
public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() throws IOException, NoSuchAlgorithmException  
{  
    TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory();  
    tomcatFactory.addConnectorCustomizers(new UKeFuTomcatConnectorCustomizer(maxthread, maxconnections));  
    File sslFile = new File(path , "ssl/https.properties") ;
    if(sslFile.exists()){
    	Properties sslProperties = new Properties();
    	FileInputStream in = new FileInputStream(sslFile);
    	sslProperties.load(in);
    	in.close();
    	if(!StringUtils.isBlank(sslProperties.getProperty("key-store")) && !StringUtils.isBlank(sslProperties.getProperty("key-store-password"))){
      Ssl ssl = new Ssl();
      ssl.setKeyStore(new File(path , "ssl/"+sslProperties.getProperty("key-store")).getAbsolutePath());
      ssl.setKeyStorePassword(UKTools.decryption(sslProperties.getProperty("key-store-password")));
      tomcatFactory.setSsl(ssl);
    	}
    }
    return tomcatFactory;  
}
 
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    KeystoreConfig cert = configureKeystore();
    if(cert == null) {
        log.debug("Ssl is not enabled due to no any configured keystore.");
        return;
    }
    String keystorePath = cert.getKeystore().getAbsolutePath();
    log.debug("Configure ssl with {} keystore.", keystorePath);
    Ssl ssl = new Ssl();
    ssl.setEnabled(true);
    ssl.setKeyStore(keystorePath);
    ssl.setKeyStorePassword(cert.getKeystorePassword());
    ssl.setKeyPassword(cert.getKeyPassword());
    container.setSsl(ssl);
}
 
源代码3 项目: ipst   文件: HistoDbConfiguration.java
public Ssl getSsl() {
    return ssl;
}
 
 类所在包
 类方法
 同包方法