當前位置: 首頁>>代碼示例>>Java>>正文


Java SelectChannelConnector.setConfidentialPort方法代碼示例

本文整理匯總了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;
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:26,代碼來源:EmbeddedJettyComponentFactory.java

示例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;
    }
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:55,代碼來源:SubsonicDeployer.java

示例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;
       }
   }
 
開發者ID:MadMarty,項目名稱:madsonic-server-5.1,代碼行數:70,代碼來源:MadsonicDeployer.java

示例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;
    }
}
 
開發者ID:MadMarty,項目名稱:madsonic-server-5.0,代碼行數:55,代碼來源:SubsonicDeployer.java


注:本文中的org.eclipse.jetty.server.nio.SelectChannelConnector.setConfidentialPort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。