当前位置: 首页>>代码示例>>Java>>正文


Java HttpConfiguration.setSecurePort方法代码示例

本文整理汇总了Java中org.eclipse.jetty.server.HttpConfiguration.setSecurePort方法的典型用法代码示例。如果您正苦于以下问题:Java HttpConfiguration.setSecurePort方法的具体用法?Java HttpConfiguration.setSecurePort怎么用?Java HttpConfiguration.setSecurePort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.server.HttpConfiguration的用法示例。


在下文中一共展示了HttpConfiguration.setSecurePort方法的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);
}
 
开发者ID:thinline72,项目名称:rpc-example,代码行数:24,代码来源:JettyHttp2ServerConfig.java

示例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);
    }
 
开发者ID:amaralDaniel,项目名称:megaphone,代码行数:21,代码来源:TestUtils.java

示例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;
}
 
开发者ID:yahoo,项目名称:mysql_perf_analyzer,代码行数:27,代码来源:App.java

示例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();
}
 
开发者ID:shri30,项目名称:ProcessPool,代码行数:23,代码来源:PoolWatcher.java

示例5: 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;
	
}
 
开发者ID:danidemi,项目名称:jlubricant,代码行数:20,代码来源:HttpConnectivity.java

示例6: 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;
}
 
开发者ID:sorskod,项目名称:webserver,代码行数:13,代码来源:HTTPSConnectorFactory.java

示例7: 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;
}
 
开发者ID:PinaeOS,项目名称:pumbaa,代码行数:14,代码来源:PumbaaServer.java

示例8: 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);
}
 
开发者ID:denkbar,项目名称:step,代码行数:32,代码来源:ControllerServer.java

示例9: 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;
}
 
开发者ID:korena,项目名称:service-base,代码行数:23,代码来源:JServer.java

示例10: 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);
    }
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:40,代码来源:InstanceProviderContainer.java

示例11: 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;
}
 
开发者ID:AndreasKl,项目名称:embedded-jetty-http2,代码行数:10,代码来源:Application.java

示例12: 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;
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:15,代码来源:RestfulServer.java

示例13: createHttpsConnector

import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
Connector createHttpsConnector(int port, SslContext context) {

		SslContextFactory sslContextFactory = new SslContextFactory();
		{
			sslContextFactory.setKeyStorePath(context.getKeystore());
			sslContextFactory.setKeyStorePassword(context.getObfKeypass());

			sslContextFactory.setTrustStorePath(context.getTruststore());
			sslContextFactory.setTrustStorePassword(context.getObfTrustpass());

			sslContextFactory.setKeyManagerPassword(context.getObfMgrpass());

			sslContextFactory.setNeedClientAuth(false);
		}

		HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
		{
			httpsConfig.setSecureScheme("https");
			httpsConfig.setSecurePort(port);
			httpsConfig.addCustomizer(new SecureRequestCustomizer());
		}

		ConnectionFactory[] factories = new ConnectionFactory[] {
				//
				new SslConnectionFactory(sslContextFactory, "http/1.1"),//
				new HttpConnectionFactory(httpsConfig) //
		};

		return connectionWith(new ServerConnector(this.server, factories), port);
	}
 
开发者ID:dohbot,项目名称:knives,代码行数:31,代码来源:EmbeddedJetty.java

示例14: main

import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
/**
 * Main entry point. Starts a Jetty server.
 *
 * @param args
 *            ignored.
 * @throws Exception
 *             if anything goes wrong.
 */
public static void main(final String[] args) throws Exception {
    // Configure logging to output to the console with default level of INFO
    BasicConfigurator.configure();

    // Configure server and its associated servlets
    Server server = new Server();
    SslConnectionFactory sslConnectionFactory = new SslConnectionFactory();
    SslContextFactory sslContextFactory = sslConnectionFactory.getSslContextFactory();
    sslContextFactory.setKeyStorePath(System.getProperty("javax.net.ssl.keyStore"));
    sslContextFactory.setKeyStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
    sslContextFactory.setIncludeCipherSuites(Sdk.SUPPORTED_CIPHER_SUITES);

    HttpConfiguration httpConf = new HttpConfiguration();
    httpConf.setSecurePort(PORT);
    httpConf.setSecureScheme(HTTPS_SCHEME);
    httpConf.addCustomizer(new SecureRequestCustomizer());
    HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(httpConf);

    ServerConnector serverConnector =
            new ServerConnector(server, sslConnectionFactory, httpConnectionFactory);
    serverConnector.setPort(PORT);

    Connector[] connectors = new Connector[1];
    connectors[0] = serverConnector;
    server.setConnectors(connectors);

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);
    context.addServlet(new ServletHolder(createServlet(new HelloWorldSpeechlet())), "/hello");
    context.addServlet(new ServletHolder(createServlet(new MinecraftSpeechlet())), "/minecrafthelper");
    context.addServlet(new ServletHolder(createServlet(new DomoticzSpeechlet())), "/domoticz");
    context.addServlet(new ServletHolder(createServlet(new SessionSpeechlet())), "/session");
    server.start();
    server.join();
}
 
开发者ID:beckdac,项目名称:alexa_domoticz_bridge,代码行数:45,代码来源:Launcher.java

示例15: createHttpConfiguration

import org.eclipse.jetty.server.HttpConfiguration; //导入方法依赖的package包/类
/**
 * 创建HttpConfiguration
 * 
 * @return HttpConfiguration
 */
public static HttpConfiguration createHttpConfiguration() {
	HttpConfiguration httpConfig = new HttpConfiguration();

	httpConfig.setSecurePort(setting.getInt("secure-port", "http", 8443));
	httpConfig.setOutputBufferSize(setting.getInt("output-buffersize", "http", 32768));
	httpConfig.setRequestHeaderSize(setting.getInt("request-headersize", "http", 8192));
	httpConfig.setResponseHeaderSize(setting.getInt("response-headersize", "http", 8192));
	httpConfig.setSendServerVersion(true);
	httpConfig.setSendDateHeader(false);

	return httpConfig;
}
 
开发者ID:looly,项目名称:hulu,代码行数:18,代码来源:JettySetting.java


注:本文中的org.eclipse.jetty.server.HttpConfiguration.setSecurePort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。