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


Java ServerConnector.setIdleTimeout方法代码示例

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


在下文中一共展示了ServerConnector.setIdleTimeout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JettyAdminServer

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
public JettyAdminServer(String address, int port, int timeout, String commandUrl) {
    this.port = port;
    this.idleTimeout = timeout;
    this.commandUrl = commandUrl;
    this.address = address;

    server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setHost(address);
    connector.setPort(port);
    connector.setIdleTimeout(idleTimeout);
    server.addConnector(connector);

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/*");
    server.setHandler(context);

    context.addServlet(new ServletHolder(new CommandServlet()), commandUrl + "/*");
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:20,代码来源:JettyAdminServer.java

示例2: setUp

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    PullHttpChangeIngestorCommonTest.init();

    final ServerConnector http = new ServerConnector(jetty);

    http.setPort(0);
    http.setHost("localhost");

    http.setIdleTimeout(3000L);
    jetty.addConnector(http);

    jetty.start();

    Thread.sleep(1000);

    if (!jetty.isStarted()) {
        throw new IllegalStateException("Jetty server not started");
    }
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:21,代码来源:PullHttpChangeIngestorTest.java

示例3: JettyHttpTestServer

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
public JettyHttpTestServer(String host, int port){
       this.host = host;
       this.port = port;
	server = new Server();

       ServerConnector http = new ServerConnector(server);
       http.setHost(host);
       http.setPort(port);
       http.setIdleTimeout(30000);

       server.addConnector(http);
       server.setHandler(new RequestHandler());

       try {
           server.start();
       } catch (Exception e) {
           e.printStackTrace();
       }

       this.port = http.getLocalPort();
}
 
开发者ID:yahoo,项目名称:parsec-libraries,代码行数:22,代码来源:JettyHttpTestServer.java

示例4: start

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
public void start() {
    try {
        final ServerConnector httpConnector = new ServerConnector(server);

        httpConnector.setHost(root.host);
        httpConnector.setPort(root.port);
        httpConnector.setIdleTimeout(config.getInt("web.idle-timeout"));
        server.addConnector(httpConnector);

        final HandlerList handlers = new HandlerList();

        handlers.addHandler(inContext("/static", newResourcesHandler()));
        handlers.addHandler(inContext("/", new RootHandler(version, routes)));

        server.setHandler(handlers);
        server.start();

        log.info("Web Server started on http://" + root.host + ":" + root.port);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        throw new RuntimeException(ex);
    }
}
 
开发者ID:alpian,项目名称:tired,代码行数:24,代码来源:WebServer.java

示例5: start

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
public void start() throws Exception {
    if (server != null) throw new IllegalStateException("started");
    Scheduler.Config config = Scheduler.$.config;

    QueuedThreadPool threadPool = new QueuedThreadPool(Runtime.getRuntime().availableProcessors() * 16);
    threadPool.setName("Jetty");

    server = new Server(threadPool);
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(config.apiPort());
    connector.setIdleTimeout(60 * 1000);

    ServletContextHandler handler = new ServletContextHandler();
    handler.addServlet(new ServletHolder(new Servlet()), "/");
    handler.setErrorHandler(new ErrorHandler());

    server.setHandler(handler);
    server.addConnector(connector);
    server.start();

    logger.info("started on port " + connector.getLocalPort());
}
 
开发者ID:elodina,项目名称:hdfs-mesos,代码行数:23,代码来源:HttpServer.java

示例6: 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

示例7: createConnector

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private void createConnector(Properties properties) {
    final ServerConnector http = new ServerConnector(jetty);

    http.setPort(Integer.parseInt(properties.getProperty(PORT_KEY, "0")));
    http.setHost(properties.getProperty(HOST_KEY, "localhost"));

    // Severely taxed or distant environments may have significant delays when executing.
    http.setIdleTimeout(30000L);
    jetty.addConnector(http);

    logger.info("Added an http connector on the host '{}' and port '{}'", new Object[]{http.getHost(), http.getPort()});
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:13,代码来源:RestChangeIngestor.java

示例8: createSecureConnector

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private void createSecureConnector(Properties properties) {
    SslContextFactory ssl = new SslContextFactory();

    if (properties.getProperty(KEYSTORE_LOCATION_KEY) != null) {
        ssl.setKeyStorePath(properties.getProperty(KEYSTORE_LOCATION_KEY));
        ssl.setKeyStorePassword(properties.getProperty(KEYSTORE_PASSWORD_KEY));
        ssl.setKeyStoreType(properties.getProperty(KEYSTORE_TYPE_KEY));
    }

    if (properties.getProperty(TRUSTSTORE_LOCATION_KEY) != null) {
        ssl.setTrustStorePath(properties.getProperty(TRUSTSTORE_LOCATION_KEY));
        ssl.setTrustStorePassword(properties.getProperty(TRUSTSTORE_PASSWORD_KEY));
        ssl.setTrustStoreType(properties.getProperty(TRUSTSTORE_TYPE_KEY));
        ssl.setNeedClientAuth(Boolean.parseBoolean(properties.getProperty(NEED_CLIENT_AUTH_KEY, "true")));
    }

    // build the connector
    final ServerConnector https = new ServerConnector(jetty, ssl);

    // set host and port
    https.setPort(Integer.parseInt(properties.getProperty(PORT_KEY, "0")));
    https.setHost(properties.getProperty(HOST_KEY, "localhost"));

    // Severely taxed environments may have significant delays when executing.
    https.setIdleTimeout(30000L);

    // add the connector
    jetty.addConnector(https);

    logger.info("Added an https connector on the host '{}' and port '{}'", new Object[]{https.getHost(), https.getPort()});
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:32,代码来源:RestChangeIngestor.java

示例9: setUp

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    PullHttpChangeIngestorCommonTest.init();

    SslContextFactory ssl = new SslContextFactory();

    ssl.setKeyStorePath("./src/test/resources/localhost-ks.jks");
    ssl.setKeyStorePassword("localtest");
    ssl.setKeyStoreType("JKS");
    ssl.setTrustStorePath("./src/test/resources/localhost-ts.jks");
    ssl.setTrustStorePassword("localtest");
    ssl.setTrustStoreType("JKS");
    ssl.setNeedClientAuth(true);

    // build the connector
    final ServerConnector https = new ServerConnector(jetty, ssl);

    // set host and port
    https.setPort(0);
    https.setHost("localhost");

    // Severely taxed environments may have significant delays when executing.
    https.setIdleTimeout(30000L);

    // add the connector
    jetty.addConnector(https);

    jetty.start();

    Thread.sleep(1000);

    if (!jetty.isStarted()) {
        throw new IllegalStateException("Jetty server not started");
    }
}
 
开发者ID:apache,项目名称:nifi-minifi,代码行数:36,代码来源:PullHttpChangeIngestorSSLTest.java

示例10: httpConnector

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private ServerConnector httpConnector(HttpConfiguration httpConfig) {
    // === jetty-http.xml ===
    ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
    http.setHost(CONFIG.getJetty().getServerHost());
    http.setPort(CONFIG.getJetty().getHttpPort());
    http.setIdleTimeout(IDLE_TIMEOUT);
    return http;
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:9,代码来源:JettyServer.java

示例11: httpsConnector

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private ServerConnector httpsConnector(HttpConfiguration httpConfig) {
    // === jetty-https.xml ===
    // SSL Context Factory
    SslContextFactory sslContextFactory = new SslContextFactory();
    sslContextFactory.setKeyStorePath(CONFIG.getJetty().getKeyStorePath());
    sslContextFactory.setKeyStorePassword(CONFIG.getJetty().getKeyStorePassword());
    sslContextFactory.setKeyManagerPassword(CONFIG.getJetty().getKeyStorePassword());
    sslContextFactory.setExcludeCipherSuites(
            "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");

    // SSL HTTP Configuration
    HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
    httpsConfig.addCustomizer(new SecureRequestCustomizer());

    // SSL Connector
    ServerConnector https = new ServerConnector(server,
            new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
            new HttpConnectionFactory(httpsConfig));
    https.setHost(CONFIG.getJetty().getServerHost());
    https.setPort(CONFIG.getJetty().getHttpsPort());
    https.setIdleTimeout(IDLE_TIMEOUT);
    return https;
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:30,代码来源:JettyServer.java

示例12: createServerConnector

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private ServerConnector createServerConnector(Server server, ConfigMap<String, Object> connectorCfg, ConnectionFactory... factories) {
	ServerConnector connector = new ServerConnector(server, factories);
	
	connector.setHost(connectorCfg.getString("address", "0.0.0.0"));
	connector.setPort(connectorCfg.getInteger("port", 80));
	connector.setIdleTimeout(connectorCfg.getLong("timeout", TimeUnit.SECONDS.toMillis(60)));
	
	server.setAttribute(MAX_BODY_SIZE_KEY,  connectorCfg.getInteger("max-body-size", 4096) * KB);
	
	return connector;
}
 
开发者ID:PinaeOS,项目名称:pumbaa,代码行数:12,代码来源:PumbaaServer.java

示例13: 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

示例14: initServerForContextualCallbacks

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
private Server initServerForContextualCallbacks(AuthServerProperties properties)
        throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException
{
    ContextualCallbackHandler contextualCallbackHandler = new ContextualCallbackHandler(this);

    Server serverForContextualCallbacks = new Server();
    serverForContextualCallbacks.setHandler(contextualCallbackHandler);

    HttpConfiguration httpConfig = new HttpConfiguration();
    httpConfig.setPersistentConnectionsEnabled(true);
    httpConfig.setSecureScheme("https");
    // time out with out keep alive messages?
    //httpConfig.setBlockingTimeout();

    httpConfig.addCustomizer(new SecureRequestCustomizer());
    //new SSL
    ServerConnector connector = new ServerConnector(serverForContextualCallbacks, new HttpConnectionFactory(httpConfig));

    connector.setPort(properties.getTrustedAuthPort());

    // Idle time out for keep alive connections
    // time out with out requests?
    connector.setIdleTimeout(properties.getTrustedAuthPortIdleTimeout());

    serverForContextualCallbacks.setConnectors(new org.eclipse.jetty.server.Connector[]{connector});

    return serverForContextualCallbacks;
}
 
开发者ID:iotauth,项目名称:iotauth,代码行数:29,代码来源:AuthServer.java

示例15: startUp

import org.eclipse.jetty.server.ServerConnector; //导入方法依赖的package包/类
@Override
public void startUp() throws Exception {
    LOGGER.info("Starting up Jetty HTTP server");
    final ServerConnector http = new ServerConnector(server);
    http.setPort(port);
    http.setIdleTimeout(IDLE_TIMEOUT);
    http.setAcceptQueueSize(ACCEPT_BACKLOG);

    server.addConnector(http);

    final ContextHandler jsonContext = new ContextHandler(JSON_ENDPOINT);
    jsonContext.setHandler(jsonEndpointHandler);
    jsonContext.setAllowNullPathInfo(true);

    final ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setWelcomeFiles(new String[]{WELCOME_FILE});
    resourceHandler.setBaseResource(Resource.newResource(WEBAPP_RESOURCE_PATH));

    final HandlerList handlerList = new HandlerList();
    handlerList.setHandlers(new Handler[]{jsonContext, resourceHandler, new DefaultHandler()});

    server.setHandler(handlerList);
    server.setStopAtShutdown(true);
    server.setStopTimeout(SHUTDOWN_GRACE_PERIOD);

    server.start();
    //server.join();
}
 
开发者ID:o,项目名称:metricd,代码行数:29,代码来源:JettyWriter.java


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