当前位置: 首页>>代码示例>>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;未经允许,请勿转载。