本文整理汇总了Java中org.eclipse.jetty.server.ssl.SslSelectChannelConnector.setPort方法的典型用法代码示例。如果您正苦于以下问题:Java SslSelectChannelConnector.setPort方法的具体用法?Java SslSelectChannelConnector.setPort怎么用?Java SslSelectChannelConnector.setPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.server.ssl.SslSelectChannelConnector
的用法示例。
在下文中一共展示了SslSelectChannelConnector.setPort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: createServer
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
private void createServer() throws MalformedURLException {
server = new Server(port);
if (Boolean.parseBoolean(Config.getBlurConfig().get("blur.console.ssl.enable", "false"))) {
SslContextFactory factory = new SslContextFactory(Boolean.parseBoolean(Config.getBlurConfig().get("blur.console.ssl.hostname.match", "true")));
factory.setKeyStorePath(Config.getBlurConfig().get("blur.console.ssl.keystore.path"));
factory.setKeyStorePassword(Config.getBlurConfig().get("blur.console.ssl.keystore.password"));
factory.setTrustStore(Config.getBlurConfig().get("blur.console.ssl.truststore.path"));
factory.setTrustStorePassword(Config.getBlurConfig().get("blur.console.ssl.truststore.password"));
SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(factory);
sslConnector.setPort(port);
server.addConnector(sslConnector);
}
// for localhost:port/console/index.html and whatever else is in the webapp directory
URL warUrl = null;
if (devMode) {
warUrl = new URL("file://" + new File(DEV_WEBAPPDIR).getAbsolutePath());
} else {
warUrl = this.getClass().getClassLoader().getResource(PROD_WEBAPPDIR);
}
String warUrlString = warUrl.toExternalForm();
WebAppContext staticContext = new WebAppContext(warUrlString, CONTEXTPATH);
staticContext.setSessionHandler(new SessionHandler());
// service calls
// ContextHandler servletContext = new ServletContextHandler(ServletContextHandler.SESSIONS);
// servletContext.setContextPath("/console/service");
ServletHandler serviceHandler = new ServletHandler();
serviceHandler.addServletWithMapping(AuthServlet.class, "/service/auth/*");
serviceHandler.addServletWithMapping(NodesServlet.class, "/service/nodes/*");
serviceHandler.addServletWithMapping(TablesServlet.class, "/service/tables/*");
serviceHandler.addServletWithMapping(QueriesServlet.class, "/service/queries/*");
serviceHandler.addServletWithMapping(SearchServlet.class, "/service/search/*");
serviceHandler.addServletWithMapping(JavascriptServlet.class, "/service/config.js");
serviceHandler.addFilterWithMapping(LoggedInFilter.class, "/service/*", FilterMapping.REQUEST);
// servletContext.setHandler(serviceHandler);
staticContext.setServletHandler(serviceHandler);
// ContextHandlerCollection handlers = new ContextHandlerCollection();
// handlers.setHandlers(new Handler[] { /*servletContext,*/ staticContext });
server.setHandler(staticContext);
System.out.println("started server on http://localhost:" + port + CONTEXTPATH);
try {
server.start();
System.out.println(server.getHandlers()[0]);
} catch (Exception e) {
log.error("Error starting Blur Console Jetty Server. Exiting", e);
System.exit(1);
}
}
示例4: createSSLConnector
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
private void createSSLConnector(int securePort) {
httpsConnector = null;
try {
if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*")) {
if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
Log.warn("HTTP binding: Using RSA certificates but they are not valid for " +
"the hosted domain");
}
final SslContextFactory sslContextFactory = new SslContextFactory(SSLConfig.getKeystoreLocation());
sslContextFactory.setTrustStorePassword(SSLConfig.getc2sTrustPassword());
sslContextFactory.setTrustStoreType(SSLConfig.getStoreType());
sslContextFactory.setTrustStore(SSLConfig.getc2sTruststoreLocation());
sslContextFactory.setKeyStorePassword(SSLConfig.getKeyPassword());
sslContextFactory.setKeyStoreType(SSLConfig.getStoreType());
// Set policy for checking client certificates
String certPol = JiveGlobals.getProperty("xmpp.client.cert.policy", "disabled");
if(certPol.equals("needed")) {
sslContextFactory.setNeedClientAuth(true);
sslContextFactory.setWantClientAuth(true);
} else if(certPol.equals("wanted")) {
sslContextFactory.setNeedClientAuth(false);
sslContextFactory.setWantClientAuth(true);
} else {
sslContextFactory.setNeedClientAuth(false);
sslContextFactory.setWantClientAuth(false);
}
final SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslContextFactory);
sslConnector.setHost(getBindInterface());
sslConnector.setPort(securePort);
configureProxiedConnector(sslConnector);
httpsConnector = sslConnector;
}
}
catch (Exception e) {
Log.error("Error creating SSL connector for Http bind", e);
}
}
示例5: createSSLConnector
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入方法依赖的package包/类
private void createSSLConnector(int securePort) {
httpsConnector = null;
try {
if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*")) {
if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
Log.warn("HTTP binding: Using RSA certificates but they are not valid for " +
"the hosted domain");
}
final SslContextFactory sslContextFactory = new SslContextFactory(SSLConfig.getKeystoreLocation());
sslContextFactory.setTrustStorePassword(SSLConfig.getc2sTrustPassword());
sslContextFactory.setTrustStoreType(SSLConfig.getStoreType());
sslContextFactory.setTrustStore(SSLConfig.getc2sTruststoreLocation());
sslContextFactory.setKeyStorePassword(SSLConfig.getKeyPassword());
sslContextFactory.setKeyStoreType(SSLConfig.getStoreType());
// Set policy for checking client certificates
String certPol = JiveGlobals.getProperty("xmpp.client.cert.policy", "disabled");
if(certPol.equals("needed")) {
sslContextFactory.setNeedClientAuth(true);
sslContextFactory.setWantClientAuth(true);
} else if(certPol.equals("wanted")) {
sslContextFactory.setNeedClientAuth(false);
sslContextFactory.setWantClientAuth(true);
} else {
sslContextFactory.setNeedClientAuth(false);
sslContextFactory.setWantClientAuth(false);
}
final SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslContextFactory);
sslConnector.setHost(getBindInterface());
sslConnector.setPort(securePort);
httpsConnector = sslConnector;
}
}
catch (Exception e) {
Log.error("Error creating SSL connector for Http bind", e);
}
}