hailin0 commented on issue #8583:
URL: https://github.com/apache/seatunnel/issues/8583#issuecomment-2611385688
> This is a demo
>
> ```
> import org.eclipse.jetty.server.Server;
> import org.eclipse.jetty.server.ServerConnector;
> import org.eclipse.jetty.util.ssl.SslContextFactory;
>
> import java.io.File;
>
> public class JettyServer {
> public static void main(String[] args) throws Exception {
> Server server = new Server();
>
> ServerConnector httpConnector = new ServerConnector(server);
> httpConnector.setPort(8080);
> server.addConnector(httpConnector);
>
> String keystorePath = "/path/to/keystore.jks";
> String keystorePassword = "your_keystore_password";
> String keyManagerPassword = "your_key_password";
>
> File keystoreFile = new File(keystorePath);
> if (keystoreFile.exists() && keystoreFile.isFile()) {
>
> SslContextFactory.Server sslContextFactory = new
SslContextFactory.Server();
> sslContextFactory.setKeyStorePath(keystorePath);
> sslContextFactory.setKeyStorePassword(keystorePassword);
> sslContextFactory.setKeyManagerPassword(keyManagerPassword);
>
> ServerConnector httpsConnector = new ServerConnector(server,
sslContextFactory);
> httpsConnector.setPort(8443);
> server.addConnector(httpsConnector);
> } else {
> System.out.println("No HTTPS configuration detected, falling
back to HTTP...");
> }
>
> server.setHandler(...);
>
> server.start();
> server.join();
> }
> }
> ```
Add
```
// optional:Two-way authentication
sslContextFactory.setTrustStorePath(/path/to/truststore);
sslContextFactory.setTrustStorePassword(truststore_password);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]