mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-28 19:09:10 +00:00
356274 Start SSL socket factory in call to open()
This commit is contained in:
parent
978f06242b
commit
94d43e4229
@ -33,6 +33,7 @@ import org.eclipse.jetty.server.handler.RequestLogHandler;
|
|||||||
import org.eclipse.jetty.server.handler.StatisticsHandler;
|
import org.eclipse.jetty.server.handler.StatisticsHandler;
|
||||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||||
|
import org.eclipse.jetty.server.ssl.SslSocketConnector;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
|
|
||||||
@ -89,7 +90,33 @@ public class LikeJettyXml
|
|||||||
});
|
});
|
||||||
ssl_connector.setStatsOn(true);
|
ssl_connector.setStatsOn(true);
|
||||||
server.addConnector(ssl_connector);
|
server.addConnector(ssl_connector);
|
||||||
|
ssl_connector.open();
|
||||||
|
|
||||||
|
|
||||||
|
SslSocketConnector ssls_connector = new SslSocketConnector();
|
||||||
|
ssls_connector.setPort(8444);
|
||||||
|
cf = ssls_connector.getSslContextFactory();
|
||||||
|
cf.setKeyStore(jetty_home + "/etc/keystore");
|
||||||
|
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||||
|
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
||||||
|
cf.setTrustStore(jetty_home + "/etc/keystore");
|
||||||
|
cf.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||||
|
cf.setExcludeCipherSuites(
|
||||||
|
new String[] {
|
||||||
|
"SSL_RSA_WITH_DES_CBC_SHA",
|
||||||
|
"SSL_DHE_RSA_WITH_DES_CBC_SHA",
|
||||||
|
"SSL_DHE_DSS_WITH_DES_CBC_SHA",
|
||||||
|
"SSL_RSA_EXPORT_WITH_RC4_40_MD5",
|
||||||
|
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
|
||||||
|
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
|
||||||
|
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
|
||||||
|
});
|
||||||
|
ssls_connector.setStatsOn(true);
|
||||||
|
server.addConnector(ssls_connector);
|
||||||
|
ssls_connector.open();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Ajp13SocketConnector ajp = new Ajp13SocketConnector();
|
Ajp13SocketConnector ajp = new Ajp13SocketConnector();
|
||||||
ajp.setPort(8009);
|
ajp.setPort(8009);
|
||||||
server.addConnector(ajp);
|
server.addConnector(ajp);
|
||||||
|
@ -30,6 +30,7 @@ import javax.net.ssl.SSLSocket;
|
|||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpSchemes;
|
||||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
import org.eclipse.jetty.io.RuntimeIOException;
|
||||||
import org.eclipse.jetty.io.bio.SocketEndPoint;
|
import org.eclipse.jetty.io.bio.SocketEndPoint;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.bio.SocketConnector;
|
import org.eclipse.jetty.server.bio.SocketConnector;
|
||||||
@ -67,6 +68,7 @@ public class SslSocketConnector extends SocketConnector implements SslConnector
|
|||||||
this(new SslContextFactory(SslContextFactory.DEFAULT_KEYSTORE_PATH));
|
this(new SslContextFactory(SslContextFactory.DEFAULT_KEYSTORE_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
public SslSocketConnector(SslContextFactory sslContextFactory)
|
public SslSocketConnector(SslContextFactory sslContextFactory)
|
||||||
{
|
{
|
||||||
_sslContextFactory = sslContextFactory;
|
_sslContextFactory = sslContextFactory;
|
||||||
@ -329,6 +331,26 @@ public class SslSocketConnector extends SocketConnector implements SslConnector
|
|||||||
return integralPort == 0 || integralPort == request.getServerPort();
|
return integralPort == 0 || integralPort == request.getServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
@Override
|
||||||
|
public void open() throws IOException
|
||||||
|
{
|
||||||
|
if (!_sslContextFactory.checkConfig())
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("SSL context is not configured correctly.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_sslContextFactory.start();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
throw new RuntimeIOException(e);
|
||||||
|
}
|
||||||
|
super.open();
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user