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


Java ServerConnector.setName方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.server.ServerConnector.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerConnector.setName方法的具體用法?Java ServerConnector.setName怎麽用?Java ServerConnector.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.server.ServerConnector的用法示例。


在下文中一共展示了ServerConnector.setName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createConnector

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
public ServerConnector createConnector(final Metric metric, final Server server, final ServerSocketChannel ch) {
    ServerConnector connector;
    if (connectorConfig.ssl().enabled()) {
        connector = new JDiscServerConnector(connectorConfig, metric, server, ch,
                                             newSslConnectionFactory(),
                                             newHttpConnectionFactory());
    } else {
        connector = new JDiscServerConnector(connectorConfig, metric, server, ch,
                                             newHttpConnectionFactory());
    }
    connector.setPort(connectorConfig.listenPort());
    connector.setName(connectorConfig.name());
    connector.setAcceptQueueSize(connectorConfig.acceptQueueSize());
    connector.setReuseAddress(connectorConfig.reuseAddress());
    double soLingerTimeSeconds = connectorConfig.soLingerTime();
    if (soLingerTimeSeconds == -1) {
        connector.setSoLingerTime(-1);
    } else {
        connector.setSoLingerTime((int)(soLingerTimeSeconds * 1000.0));
    }
    connector.setIdleTimeout((long)(connectorConfig.idleTimeout() * 1000.0));
    connector.setStopTimeout((long)(connectorConfig.stopTimeout() * 1000.0));
    return connector;
}
 
開發者ID:vespa-engine,項目名稱:vespa,代碼行數:25,代碼來源:ConnectorFactory.java

示例2: run

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
@Override
public void run() {
  Server server = new Server(new QueuedThreadPool(maxThreads, 9, (int) idleTimeout, queue));
  ServerConnector connector = new ServerConnector(server, acceptors, selectors);
  connector.setIdleTimeout(idleTimeout);
  connector.setPort(port);
  connector.setHost(host);
  connector.setName("Continuum Ingress");
  
  server.setConnectors(new Connector[] { connector });

  HandlerList handlers = new HandlerList();
  
  Handler cors = new CORSHandler();
  handlers.addHandler(cors);

  handlers.addHandler(new InfluxDBHandler(url, token));
  
  server.setHandler(handlers);
  
  JettyUtil.setSendServerVersion(server, false);

  try {
    server.start();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:29,代碼來源:InfluxDBWarp10Plugin.java

示例3: setupHttpConnectors

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的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

示例4: setupHttpsConnectors

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
/**
 * This method is used to setup a secure connector, it requires valid
 * keystore information in the config.properties file. Things to note: The
 * securePort parameter is the port that this server will bind to, the
 * purpose of this port is to allow the application to be started by a
 * normal user without the need to bind to one of the first 1024 port
 * numbers, which are privileged and need the application to be started as
 * root. So this parameter will be an unprivileged port number (high
 * number).
 *
 * The actualSecurePort parameter will follow the standard port 443, so that
 * your services can be reached using the standard ssl port.
 *
 * This implies that there has to be some kind of an external tool
 * (NFTables/iptables/firewall/proxy server ...) that will route requests
 * arriving at actualSecurePort to securePort for this application to
 * handle.
 *
 * Depending on the use_ssl setting found in active.properties file, this
 * method might be used or ignored. If ignored, your application will not
 * need a keystore, and you will be using unencrypted http ... not good for
 * you.
 *
 *
 * @param securePort
 * @param actualSecurePort
 * @param keystorePath
 * @param ketStorePass
 * @return
 */
private static ServerConnector setupHttpsConnectors(int securePort, int actualSecurePort, String keystorePath, String ketStorePass) {
    /*CONNECTORS BUSINESS*/
    HttpConfiguration httpsConf = new HttpConfiguration();
    httpsConf.setSecurePort(actualSecurePort);
    httpsConf.setSecureScheme("https");
    httpsConf.addCustomizer(new SecureRequestCustomizer());
    //Set up SSL keystore
    SslContextFactory sslContextFactory = new SslContextFactory(keystorePath);
    sslContextFactory.setKeyStorePassword(ketStorePass);
    ServerConnector sslConnector = new ServerConnector(embed_server,
            new SslConnectionFactory(sslContextFactory, "http/1.1"),
            new HttpConnectionFactory(httpsConf));
    sslConnector.setPort(securePort);
    sslConnector.setName("secured");
    return sslConnector;
}
 
開發者ID:korena,項目名稱:service-base,代碼行數:47,代碼來源:JServer.java


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