本文整理汇总了Java中org.eclipse.jetty.server.ssl.SslSocketConnector.setKeystore方法的典型用法代码示例。如果您正苦于以下问题:Java SslSocketConnector.setKeystore方法的具体用法?Java SslSocketConnector.setKeystore怎么用?Java SslSocketConnector.setKeystore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.server.ssl.SslSocketConnector
的用法示例。
在下文中一共展示了SslSocketConnector.setKeystore方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSslListener
import org.eclipse.jetty.server.ssl.SslSocketConnector; //导入方法依赖的package包/类
/**
* Creates a SSLListener with all the default options. The listener will use all the default options.
* @param address - The address the listener will listen to.
* @param port - The port the listener will listen to.
* @return - Newly created listener
* @throws UnknownHostException
*/
public static SslSocketConnector buildSslListener(String address, int port) throws UnknownHostException {
int listeners = 0;
if (_server != null) {
listeners = _server.getConnectors().length;
}
SslSocketConnector ssl = new SslSocketConnector();
ssl.setProvider(_secMan.getSecurityProvider());
//ssl.setCipherSuites(_secMan.getSupprtedSSLCipherSuites()); Removed in Jetty 5->6 port.
ssl.setHost(address);
ssl.setPort(port);
ssl.setWantClientAuth(false); // Don't care about client authentication.
ssl.setPassword(KeyStoreProvider.DEFAULT_KEYSTORE_PASSWORD);
ssl.setKeyPassword(KeyStoreProvider.DEFAULT_KEYSTORE_PASSWORD);
ssl.setKeystoreType(KeyStore.getDefaultType());
ssl.setKeystore(KeyStoreProvider.getKeyStoreLocation());
ssl.setName("SSL Listener-" + ++listeners);
return ssl;
}
示例2: getConnector
import org.eclipse.jetty.server.ssl.SslSocketConnector; //导入方法依赖的package包/类
private SocketConnector getConnector() {
if ( sslConfig != null ) {
log.logBasic( BaseMessages.getString( PKG, "WebServer.Log.SslModeUsing" ) );
SslSocketConnector connector = new SslSocketConnector();
connector.setKeystore( sslConfig.getKeyStore() );
connector.setPassword( sslConfig.getKeyStorePassword() );
connector.setKeyPassword( sslConfig.getKeyPassword() );
connector.setKeystoreType( sslConfig.getKeyStoreType() );
return connector;
} else {
return new SocketConnector();
}
}
示例3: deployWebApp
import org.eclipse.jetty.server.ssl.SslSocketConnector; //导入方法依赖的package包/类
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
connector.setHost(getHost());
connector.setPort(getPort());
if (isHttpsEnabled()) {
connector.setConfidentialPort(getHttpsPort());
}
server.addConnector(connector);
if (isHttpsEnabled()) {
SslSocketConnector sslConnector = new SslSocketConnector();
sslConnector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
sslConnector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setHost(getHost());
sslConnector.setPort(getHttpsPort());
sslConnector.setKeystore(System.getProperty("subsonic.ssl.keystore", getClass().getResource("/subsonic.keystore").toExternalForm()));
sslConnector.setPassword(System.getProperty("subsonic.ssl.password", "subsonic"));
server.addConnector(sslConnector);
}
WebAppContext context = new WebAppContext();
context.setTempDirectory(getJettyDirectory());
context.setContextPath(getContextPath());
context.setWar(getWar());
if (isHttpsEnabled()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
Constraint constraint = new Constraint();
constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
constraintMapping.setPathSpec("/");
constraintMapping.setConstraint(constraint);
ConstraintSecurityHandler csh = (ConstraintSecurityHandler) context.getSecurityHandler();
csh.setConstraintMappings(new ConstraintMapping[]{constraintMapping});
}
server.setHandler(context);
server.start();
System.err.println("FutureSonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}
示例4: deployWebApp
import org.eclipse.jetty.server.ssl.SslSocketConnector; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
connector.setHost(getHost());
connector.setPort(getPort());
if (isHttpsEnabled()) {
connector.setConfidentialPort(getHttpsPort());
}
server.addConnector(connector);
if (isHttpsEnabled()) {
SslSocketConnector sslConnector = new SslSocketConnector();
SslContextFactory sslContextFactory = sslConnector.getSslContextFactory();
sslContextFactory = sslConnector.getSslContextFactory();
sslContextFactory.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"
});
sslContextFactory.addExcludeProtocols(new String[]{"SSLv3","SSLv2Hello"});
sslConnector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
sslConnector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setHost(getHost());
sslConnector.setPort(getHttpsPort());
sslConnector.setKeystore(System.getProperty("subsonic.ssl.keystore", getClass().getResource("/subsonic.keystore").toExternalForm()));
sslConnector.setPassword(System.getProperty("subsonic.ssl.password", "subsonic"));
server.addConnector(sslConnector);
}
WebAppContext context = new WebAppContext();
context.setTempDirectory(getJettyDirectory());
context.setContextPath(getContextPath());
context.setWar(getWar());
context.setOverrideDescriptor("/web-jetty.xml");
if (isHttpsEnabled()) {
// Allow non-https for streaming and cover art (for Chromecast, UPnP etc)
((ConstraintSecurityHandler) context.getSecurityHandler()).setConstraintMappings(new ConstraintMapping[]{
createConstraintMapping("/stream", Constraint.DC_NONE),
createConstraintMapping("/coverArt.view", Constraint.DC_NONE),
createConstraintMapping("/", Constraint.DC_CONFIDENTIAL)
});
}
server.setHandler(context);
server.start();
System.err.println("Madsonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}
示例5: deployWebApp
import org.eclipse.jetty.server.ssl.SslSocketConnector; //导入方法依赖的package包/类
private void deployWebApp() {
try {
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
connector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
connector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
connector.setHost(getHost());
connector.setPort(getPort());
if (isHttpsEnabled()) {
connector.setConfidentialPort(getHttpsPort());
}
server.addConnector(connector);
if (isHttpsEnabled()) {
SslSocketConnector sslConnector = new SslSocketConnector();
sslConnector.setMaxIdleTime(MAX_IDLE_TIME_MILLIS);
sslConnector.setRequestHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setResponseHeaderSize(HEADER_BUFFER_SIZE);
sslConnector.setHost(getHost());
sslConnector.setPort(getHttpsPort());
sslConnector.setKeystore(System.getProperty("subsonic.ssl.keystore", getClass().getResource("/subsonic.keystore").toExternalForm()));
sslConnector.setPassword(System.getProperty("subsonic.ssl.password", "subsonic"));
server.addConnector(sslConnector);
}
WebAppContext context = new WebAppContext();
context.setTempDirectory(getJettyDirectory());
context.setContextPath(getContextPath());
context.setWar(getWar());
if (isHttpsEnabled()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
Constraint constraint = new Constraint();
constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
constraintMapping.setPathSpec("/");
constraintMapping.setConstraint(constraint);
ConstraintSecurityHandler csh = (ConstraintSecurityHandler) context.getSecurityHandler();
csh.setConstraintMappings(new ConstraintMapping[]{constraintMapping});
}
server.setHandler(context);
server.start();
System.err.println("Madsonic running on: " + getUrl());
if (isHttpsEnabled()) {
System.err.println(" and: " + getHttpsUrl());
}
} catch (Throwable x) {
x.printStackTrace();
exception = x;
}
}