Skip to content

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
smthing committed Nov 7, 2024
1 parent aa72515 commit cfd86c6
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.smartboot.http.server.impl.WebSocketRequestImpl;
import org.smartboot.http.server.impl.WebSocketResponseImpl;
import org.smartboot.socket.extension.plugins.SslPlugin;
import org.smartboot.socket.extension.ssl.factory.PemServerSSLContextFactory;
import org.smartboot.socket.extension.ssl.factory.ServerSSLContextFactory;
import tech.smartboot.servlet.Container;
import tech.smartboot.servlet.ServletContextRuntime;
import tech.smartboot.servlet.conf.ServletInfo;
Expand Down Expand Up @@ -126,8 +126,9 @@ public void handle(WebSocketRequest request, WebSocketResponse response) {
if (containerConfig.isSsl()) {

try {
// ServerSSLContextFactory sslPlugin = new ServerSSLContextFactory(new FileInputStream(containerConfig.getKeystorePath()), "changeit", "changeit");
PemServerSSLContextFactory sslPlugin = new PemServerSSLContextFactory(new FileInputStream("/Users/zhengjw22mac123/IdeaProjects/smart-servlet/tck/src/test/resources/smart-servlet.pem"));
ServerSSLContextFactory sslPlugin = new ServerSSLContextFactory(new FileInputStream(containerConfig.getKeystorePath()), "changeit", "changeit");
// PemServerSSLContextFactory sslPlugin = new PemServerSSLContextFactory(new FileInputStream("/Users/zhengjw22mac123/IdeaProjects/smart-servlet/tck/src/test/resources/smart-servlet.pem"));
bootstrap.configuration().host(containerConfig.getBindAddress());
bootstrap.configuration().addPlugin(new SslPlugin<>(sslPlugin, new Consumer<SSLEngine>() {
@Override
public void accept(SSLEngine sslEngine) {
Expand All @@ -142,8 +143,7 @@ public void accept(SSLEngine sslEngine) {
}
bootstrap.configuration().setHttpIdleTimeout(120000);
bootstrap.setPort(containerConfig.getBindHttpPort()).start();
listeningHost = "127.0.0.1";
// listeningHost = containerConfig.getBindAddress();
listeningHost = containerConfig.getBindAddress();
listeningPort = containerConfig.getBindHttpPort();
System.out.println("host: " + listeningHost + " port:" + listeningPort + " ssl:" + containerConfig.isSsl());
}
Expand Down

0 comments on commit cfd86c6

Please sign in to comment.