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


Java SslSelectChannelConnector类代码示例

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


SslSelectChannelConnector类属于org.eclipse.jetty.server.ssl包,在下文中一共展示了SslSelectChannelConnector类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureAndStart

import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入依赖的package包/类
/**
 * Configures and starts a new Jetty server instance.
 * This server is configured to answer incoming request in a dummy way.
 * @param server the server that should be started
 * @param httpPort the http server port
 * @param httpsPort the https server port
 * @param isPerfTest determines whether server is started in performance test mode or not
 * @throws Exception
 */
public void configureAndStart(final Server server, final Integer httpPort, final Integer httpsPort, final Boolean isPerfTest) {
    try {
        SelectChannelConnector httpConnector = createHttpConnector(httpPort);
        SslSelectChannelConnector sslConnector = createSslConnector(httpsPort);
        server.setConnectors(new Connector[]{httpConnector, sslConnector});
        if (isPerfTest) {
            server.setHandler(new PerformanceTestHandler());
        } else {
            server.setHandler(new CompositeHandler(new ExampleHandler(new InputStreamConverter()), new SequenceTestHandler(new InputStreamConverter()), new PerformanceTestHandler()));
        }
        startServer(server);
        server.join();
    } catch (Exception e) {
        throw new SystemException("server cannot be started", e);
    }
}
 
开发者ID:epam,项目名称:Wilma,代码行数:26,代码来源:JettyServer.java

示例2: 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;
}
 
开发者ID:epam,项目名称:Wilma,代码行数:10,代码来源:JettyServer.java

示例3: 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);
    }
}
 
开发者ID:christian-posta,项目名称:activemq-apollo-java-port,代码行数:30,代码来源:WsTransportServer.java

示例4: 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;
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:55,代码来源:TestClient1.java

示例5: createSslSelectChannelConnector

import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; //导入依赖的package包/类
SslSelectChannelConnector createSslSelectChannelConnector() {
    return new SslSelectChannelConnector();
}
 
开发者ID:epam,项目名称:Wilma,代码行数:4,代码来源:JettyServer.java

示例6: 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);
    }
  }
 
开发者ID:apache,项目名称:incubator-blur,代码行数:56,代码来源:JettyServer.java

示例7: 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);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:42,代码来源:HttpBindManager.java

示例8: 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);
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:42,代码来源:HttpBindManager.java


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