本文整理汇总了Java中org.eclipse.jetty.server.HttpConfiguration.setSecureScheme方法的典型用法代码示例。如果您正苦于以下问题:Java HttpConfiguration.setSecureScheme方法的具体用法?Java HttpConfiguration.setSecureScheme怎么用?Java HttpConfiguration.setSecureScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.server.HttpConfiguration
的用法示例。
在下文中一共展示了HttpConfiguration.setSecureScheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customize
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
@Override
public void customize(Server server) {
// HTTPS Configuration
HttpConfiguration httpsConfig = new HttpConfiguration();
httpsConfig.setSecureScheme("https");
httpsConfig.setSecurePort(8443);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("keystore"));
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
// SSL Connection Factory
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, "h2");
// HTTP/2 Connector
ServerConnector http2Connector = new ServerConnector(server, ssl, new HTTP2ServerConnectionFactory(httpsConfig));
http2Connector.setPort(8443);
server.addConnector(http2Connector);
}
示例2: addHttpsConnector
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
public static void addHttpsConnector(Server server, int port) throws IOException, URISyntaxException {
String keyStoreFile = resourceAsFile("ssltest-keystore.jks").getAbsolutePath();
SslContextFactory sslContextFactory = new SslContextFactory(keyStoreFile);
sslContextFactory.setKeyStorePassword("changeit");
String trustStoreFile = resourceAsFile("ssltest-cacerts.jks").getAbsolutePath();
sslContextFactory.setTrustStorePath(trustStoreFile);
sslContextFactory.setTrustStorePassword("changeit");
HttpConfiguration httpsConfig = new HttpConfiguration();
httpsConfig.setSecureScheme("https");
httpsConfig.setSecurePort(port);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
ServerConnector connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
connector.setPort(port);
server.addConnector(connector);
}
示例3: sslConnector
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
/**
* Create ssl connector if https is used
* @return
*/
private ServerConnector sslConnector() {
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(this.getPort());
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
SslContextFactory sslContextFactory = new SslContextFactory(this.getCertKeyStorePath());
sslContextFactory.setKeyStorePassword(this.getCertKeyStorePassword());
//exclude weak ciphers
sslContextFactory.setExcludeCipherSuites("^.*_(MD5|SHA|SHA1)$");
//only support tlsv1.2
sslContextFactory.addExcludeProtocols("SSL", "SSLv2", "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1");
ServerConnector connector = new ServerConnector(jettyServer,
new SslConnectionFactory(sslContextFactory, "http/1.1"),
new HttpConnectionFactory(https_config));
connector.setPort(this.getPort());
connector.setIdleTimeout(50000);
return connector;
}
示例4: startServer
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
/**
* Start the Jetty Server on the specified port
* @throws Exception
*/
private static void startServer() throws Exception {
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
http_config.setOutputBufferSize(32768);
Server server = new Server();
ServerConnector http = new ServerConnector(server,
new HttpConnectionFactory(http_config));
http.setPort(_port);
http.setIdleTimeout(30000);
server.setConnectors(new Connector[] { http });
// Set a handler
server.setHandler(new PoolWatcher());
// Start the server
server.start();
}
示例5: createSSLConnector
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private ServerConnector createSSLConnector() {
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(m_keystore);
sslContextFactory.setKeyStorePassword(m_keystorepassword);
sslContextFactory.setTrustStorePath(m_truststore);
sslContextFactory.setTrustStorePassword(m_truststorepassword);
sslContextFactory.setNeedClientAuth(m_clientauthentication);
sslContextFactory.setIncludeCipherSuites(m_tls_cipher_suites);
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
SslConnectionFactory sslConnFactory = new SslConnectionFactory(sslContextFactory, "http/1.1");
HttpConnectionFactory httpConnFactory = new HttpConnectionFactory(https_config);
ServerConnector sslConnector = new ServerConnector(m_jettyServer, sslConnFactory, httpConnFactory);
return sslConnector;
}
示例6: doInstall
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
public Connector doInstall(Server server){
// shared http config
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
http_config.setOutputBufferSize(32768);
// HTTP connector #1
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
http.setPort(httpPort);
http.setIdleTimeout(idleTimeout == null ? 30000 : idleTimeout);
if(host != null){
http.setHost(host);
}
return http;
}
示例7: get
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
@Override
public ServerConnector get(Server server) {
HttpConfiguration configuration = new HttpConfiguration(defaultConfig);
configuration.setSecurePort(configurator.getPort());
configuration.setSecureScheme(HttpScheme.HTTPS.asString());
final ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(configuration));
connector.setPort(configurator.getPort());
connector.setHost(configurator.getHost());
return connector;
}
示例8: createHttpConfiguration
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private HttpConfiguration createHttpConfiguration(ConfigMap<String, Object> connectorCfg) {
HttpConfiguration httpConfig = new HttpConfiguration();
if (connectorCfg.getBoolean("ssl", false) == true) {
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(connectorCfg.getInteger("port", 443));
}
httpConfig.setOutputBufferSize(connectorCfg.getInteger("output-buffer-size", 32) * KB);
httpConfig.setRequestHeaderSize(connectorCfg.getInteger("request-header-size", 256) * KB);
httpConfig.setResponseHeaderSize(connectorCfg.getInteger("response-header-size", 256) * KB);
return httpConfig;
}
示例9: startProxy
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
public int startProxy() throws Exception {
seenByProxy.clear();
InetAddress address = InetAddress.getLoopbackAddress();
httpProxyPort = NetworkUtils.getNextAvailablePort(address);
// Setup Threadpool
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(500);
server = new Server(threadPool);
// HTTP Configuration
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSendServerVersion(true);
httpConfig.setSendDateHeader(false);
// Handler Structure
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] {proxyHandler(), new DefaultHandler()});
server.setHandler(handlers);
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
http.setPort(httpProxyPort);
server.addConnector(http);
server.start();
return httpProxyPort;
}
示例10: initServerForContextualCallbacks
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private Server initServerForContextualCallbacks(AuthServerProperties properties)
throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
{
ContextualCallbackHandler contextualCallbackHandler = new ContextualCallbackHandler(this);
Server serverForContextualCallbacks = new Server();
serverForContextualCallbacks.setHandler(contextualCallbackHandler);
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setPersistentConnectionsEnabled(true);
httpConfig.setSecureScheme("https");
// time out with out keep alive messages?
//httpConfig.setBlockingTimeout();
httpConfig.addCustomizer(new SecureRequestCustomizer());
//new SSL
ServerConnector connector = new ServerConnector(serverForContextualCallbacks, new HttpConnectionFactory(httpConfig));
connector.setPort(properties.getTrustedAuthPort());
// Idle time out for keep alive connections
// time out with out requests?
connector.setIdleTimeout(properties.getTrustedAuthPortIdleTimeout());
serverForContextualCallbacks.setConnectors(new org.eclipse.jetty.server.Connector[]{connector});
return serverForContextualCallbacks;
}
示例11: setupConnectors
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private void setupConnectors() {
Configuration conf = Configuration.getInstance();
HttpConfiguration http = new HttpConfiguration();
http.addCustomizer(new SecureRequestCustomizer());
http.setSecureScheme("https");
ServerConnector connector = new ServerConnector(server);
connector.addConnectionFactory(new HttpConnectionFactory(http));
connector.setPort(port);
if(conf.getPropertyAsBoolean("ui.ssl.enabled", false)) {
int httpsPort = conf.getPropertyAsInteger("ui.ssl.port", 443);
http.setSecurePort(httpsPort);
HttpConfiguration https = new HttpConfiguration();
https.addCustomizer(new SecureRequestCustomizer());
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(conf.getProperty("ui.ssl.keystore.path"));
sslContextFactory.setKeyStorePassword(conf.getProperty("ui.ssl.keystore.password"));
sslContextFactory.setKeyManagerPassword(conf.getProperty("ui.ssl.keymanager.password"));
ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https));
sslConnector.setPort(httpsPort);
server.addConnector(sslConnector);
}
server.addConnector(connector);
}
示例12: setupHttpConnectors
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
/**
* This method sets up an insecure connector, and binds it to the port
* defined in active.properties as http_port, if you do not want to use
* https (why wouldn't you !?) , this is the only connector that will be
* used to reach your application.
*
* @param port
* @param securePort
* @return
*/
private static ServerConnector setupHttpConnectors(int port, int securePort) {
/*CONNECTORS BUSINESS*/
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(securePort);
httpConf.setSecureScheme("https");
ServerConnector httpConnector = new ServerConnector(embed_server,
new HttpConnectionFactory(httpConf));
httpConnector.setName("unsecured"); // named connector
httpConnector.setPort(port);
return httpConnector;
}
示例13: run
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
public void run() {
try {
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(16);
Server server = new Server(threadPool);
ServletContextHandler handler = new ServletContextHandler();
handler.setContextPath("");
ResourceConfig config = new ResourceConfig(InstanceProviderResources.class).register(new Binder());
handler.addServlet(new ServletHolder(new ServletContainer(config)), "/*");
server.setHandler(handler);
// SSL Context Factory
SslContextFactory sslContextFactory = createSSLContextObject();
// SSL HTTP Configuration
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(10043);
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
// SSL Connector
ServerConnector sslConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfig));
sslConnector.setPort(10043);
server.addConnector(sslConnector);
server.start();
server.join();
} catch (Exception e) {
System.err.println("*** " + e);
}
}
示例14: createHttpConfiguration
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private static HttpConfiguration createHttpConfiguration() {
HttpConfiguration config = new HttpConfiguration();
config.setSecureScheme("https");
config.setSecurePort(SSL_PORT);
config.setSendXPoweredBy(false);
config.setSendServerVersion(false);
config.addCustomizer(new SecureRequestCustomizer());
return config;
}
示例15: buildHttpConfiguration
import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
private HttpConfiguration buildHttpConfiguration(int port) {
// HTTP Configuration
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(port);
httpConfig.setOutputBufferSize(32768);
httpConfig.setRequestHeaderSize(8192);
httpConfig.setResponseHeaderSize(8192);
httpConfig.setSendServerVersion(true);
httpConfig.setSendDateHeader(false);
httpConfig.setBlockingTimeout(30000); // Config
// httpConfig.addCustomizer(new ForwardedRequestCustomizer());
return httpConfig;
}