本文整理汇总了Java中org.eclipse.jetty.server.ssl.SslSelectChannelConnector.getSslContextFactory方法的典型用法代码示例。如果您正苦于以下问题:Java SslSelectChannelConnector.getSslContextFactory方法的具体用法?Java SslSelectChannelConnector.getSslContextFactory怎么用?Java SslSelectChannelConnector.getSslContextFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.server.ssl.SslSelectChannelConnector
的用法示例。
在下文中一共展示了SslSelectChannelConnector.getSslContextFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSslConnector
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
private SslSelectChannelConnector createSslConnector(final Integer port) {
SslSelectChannelConnector sslConnector = createSslSelectChannelConnector();
sslConnector.setPort(port);
SslContextFactory cf = sslConnector.getSslContextFactory();
cf.setKeyStorePath("certificate/wilmaKeystore.jks");
cf.setKeyStorePassword("secret123");
cf.setKeyManagerPassword("secret123");
return sslConnector;
}
示例2: resolveConnector
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
private Connector resolveConnector(String scheme, Map<String, String> options) {
if (isWebSocket(scheme)) {
return new SelectChannelConnector();
}else if (isSecureWebSocket(scheme)) {
SSLContext context = resolveSslContext();
SslSelectChannelConnector channelConnector = new SslSelectChannelConnector();
SslContextFactory sslSettings = channelConnector.getSslContextFactory();
sslSettings.setSslContext(context);
if (options.containsKey("client_auth")) {
String clientAuth = options.get("client_auth");
if (clientAuth != null) {
sslSettings.setWantClientAuth(true);
}else if("want".equals(clientAuth)) {
sslSettings.setWantClientAuth(true);
}else if("need".equals(clientAuth)) {
sslSettings.setNeedClientAuth(true);
}else if("none".equals(clientAuth)) {
// don't do anything? default to whatever jetty uses
} else {
LOG.warn("Invalid setting for the wss protocol 'client_auth' query option. Please set to one of: none, want, need");
}
}
return channelConnector;
} else {
throw new RuntimeException("Invalid bind protocol: " + scheme);
}
}
示例3: createServer
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
/**
* Creates a Server that exposes the TestClient1 services via http and https
*
* @return the Server instance
*/
@Override
protected Server createServer() {
// Need this CredentialsSourceFactory in our config to enable our test of basic auth
// with our httpInvoker-echoServiceSecure
registerTestCredentialsSourceFactory();
ConfigConstants configConstants = new ConfigConstants();
Server server = new Server();
SelectChannelConnector connector0 = new SelectChannelConnector();
connector0.setPort(configConstants.SERVER_HTTP_PORT);
connector0.setMaxIdleTime(30000);
connector0.setRequestHeaderSize(8192);
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
ssl_connector.setPort(configConstants.SERVER_HTTPS_PORT);
SslContextFactory cf = ssl_connector.getSslContextFactory();
cf.setKeyStore(configConstants.KEYSTORE_PATH);
cf.setKeyStorePassword(configConstants.KEYSTORE_PASS);
cf.setKeyManagerPassword(configConstants.KEYSTORE_PASS);
server.setConnectors(new Connector[]{connector0, ssl_connector});
URL webRoot = getClass().getClassLoader().getResource(configConstants.WEB_ROOT);
String location = webRoot.getPath();
LOG.debug("#####################################");
LOG.debug("#");
LOG.debug("# Starting Client1 using following web root " + location);
LOG.debug("#");
LOG.debug("#####################################");
WebAppContext context = new WebAppContext();
context.setResourceBase(location);
context.setContextPath(configConstants.CONTEXT);
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(context);
server.setHandler(handlers);
server.setDumpAfterStart(true);
//server.setDumpBeforeStop(true);
return server;
}