本文整理匯總了Java中org.eclipse.jetty.server.nio.SelectChannelConnector.setConfidentialPort方法的典型用法代碼示例。如果您正苦於以下問題:Java SelectChannelConnector.setConfidentialPort方法的具體用法?Java SelectChannelConnector.setConfidentialPort怎麽用?Java SelectChannelConnector.setConfidentialPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.server.nio.SelectChannelConnector
的用法示例。
在下文中一共展示了SelectChannelConnector.setConfidentialPort方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initJettyServer
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的package包/類
private Server initJettyServer(ComponentRepository repo) {
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(getPort());
connector.setConfidentialPort(getSecurePort());
connector.setRequestHeaderSize(16384);
Server jettyServer = new Server();
jettyServer.setConnectors(new Connector[] {connector});
ContextHandlerCollection contexts = new ContextHandlerCollection();
HandlerCollection handlers = new HandlerCollection();
handlers.addHandler(contexts);
addHandlers(repo, jettyServer, contexts);
jettyServer.setHandler(handlers);
jettyServer.setStopAtShutdown(true);
jettyServer.setGracefulShutdown(2000);
jettyServer.setSendDateHeader(true);
jettyServer.setSendServerVersion(true);
ComponentInfo info = new ComponentInfo(Server.class, "jetty");
repo.registerComponent(info, jettyServer);
repo.registerLifecycle(new ServerLifecycle(jettyServer));
return jettyServer;
}
示例2: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的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;
}
}
示例3: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的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;
}
}
示例4: deployWebApp
import org.eclipse.jetty.server.nio.SelectChannelConnector; //導入方法依賴的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;
}
}