This commit is contained in:
Redkale
2018-03-12 21:50:17 +08:00
parent e223548b23
commit 34e37471b8
2 changed files with 12 additions and 5 deletions

View File

@@ -126,6 +126,12 @@
-->
<server protocol="HTTP" host="127.0.0.1" port="6060" root="root" lib="">
<!--
【节点在<server>中唯一】
value: 创建SSLContext的实现类, 可自定义必须是org.redkale.net.SSLCreator的子类
-->
<ssl creator="" p12="{APP_HOME}/conf/xxx.p12" jks="{APP_HOME}/conf/xxx.jks" pem="{APP_HOME}/conf/xxx.pem"/>
<!--
加载所有的Service服务;
在同一个进程中同一个name同一类型的Service将共用同一个实例

View File

@@ -127,15 +127,16 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
AnyValue sslConf = config.getAnyValue("ssl");
if (sslConf != null) {
String creatorClass = sslConf.getValue("creator", SSLCreator.class.getName());
SSLCreator creator = null;
if (SSLCreator.class.getName().equals(creatorClass) || creatorClass.isEmpty()) {
this.sslContext = new SSLCreator() {
}.create(this, sslConf);
creator = new SSLCreator() {
};
} else {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@SuppressWarnings("unchecked")
SSLCreator creator = ((SSLCreator) classLoader.loadClass(creatorClass).getDeclaredConstructor().newInstance());
this.sslContext = creator.create(this, sslConf);
creator = ((SSLCreator) classLoader.loadClass(creatorClass).getDeclaredConstructor().newInstance());
}
this.resourceFactory.inject(creator);
this.sslContext = creator.create(this, sslConf);
}
final AtomicInteger counter = new AtomicInteger();
final Format f = createFormat();