예제 #1
0
 private boolean anyChangeRequiresRestart(HTTPConnectionHandlerCfg newCfg) {
   return !equals(newCfg.getListenPort(), initConfig.getListenPort())
       || !Objects.equals(newCfg.getListenAddress(), initConfig.getListenAddress())
       || !equals(newCfg.getMaxRequestSize(), currentConfig.getMaxRequestSize())
       || !equals(newCfg.isAllowTCPReuseAddress(), currentConfig.isAllowTCPReuseAddress())
       || !equals(newCfg.isUseTCPKeepAlive(), currentConfig.isUseTCPKeepAlive())
       || !equals(newCfg.isUseTCPNoDelay(), currentConfig.isUseTCPNoDelay())
       || !equals(
           newCfg.getMaxBlockedWriteTimeLimit(), currentConfig.getMaxBlockedWriteTimeLimit())
       || !equals(newCfg.getBufferSize(), currentConfig.getBufferSize())
       || !equals(newCfg.getAcceptBacklog(), currentConfig.getAcceptBacklog())
       || !equals(newCfg.isUseSSL(), currentConfig.isUseSSL())
       || !Objects.equals(
           newCfg.getKeyManagerProviderDN(), currentConfig.getKeyManagerProviderDN())
       || !Objects.equals(newCfg.getSSLCertNickname(), currentConfig.getSSLCertNickname())
       || !Objects.equals(
           newCfg.getTrustManagerProviderDN(), currentConfig.getTrustManagerProviderDN())
       || !Objects.equals(newCfg.getSSLProtocol(), currentConfig.getSSLProtocol())
       || !Objects.equals(newCfg.getSSLCipherSuite(), currentConfig.getSSLCipherSuite())
       || !Objects.equals(newCfg.getSSLClientAuthPolicy(), currentConfig.getSSLClientAuthPolicy());
 }
예제 #2
0
  private HttpServer createHttpServer() {
    final HttpServer server = new HttpServer();

    final int requestSize = (int) currentConfig.getMaxRequestSize();
    final ServerConfiguration serverConfig = server.getServerConfiguration();
    serverConfig.setMaxBufferedPostSize(requestSize);
    serverConfig.setMaxFormPostSize(requestSize);
    serverConfig.setDefaultQueryEncoding(Charsets.UTF8_CHARSET);

    if (keepStats()) {
      setHttpStatsProbe(server);
    }

    // Configure the network listener
    final NetworkListener listener =
        new NetworkListener(
            "Rest2LDAP", NetworkListener.DEFAULT_NETWORK_HOST, initConfig.getListenPort());
    server.addListener(listener);

    // Configure the network transport
    final TCPNIOTransport transport = listener.getTransport();
    transport.setReuseAddress(currentConfig.isAllowTCPReuseAddress());
    transport.setKeepAlive(currentConfig.isUseTCPKeepAlive());
    transport.setTcpNoDelay(currentConfig.isUseTCPNoDelay());
    transport.setWriteTimeout(currentConfig.getMaxBlockedWriteTimeLimit(), TimeUnit.MILLISECONDS);

    final int bufferSize = (int) currentConfig.getBufferSize();
    transport.setReadBufferSize(bufferSize);
    transport.setWriteBufferSize(bufferSize);
    transport.setIOStrategy(SameThreadIOStrategy.getInstance());

    final int numRequestHandlers =
        getNumRequestHandlers(currentConfig.getNumRequestHandlers(), friendlyName);
    transport.setSelectorRunnersCount(numRequestHandlers);
    transport.setServerConnectionBackLog(currentConfig.getAcceptBacklog());

    // Configure SSL
    if (sslEngineConfigurator != null) {
      listener.setSecure(true);
      listener.setSSLEngineConfig(sslEngineConfigurator);
    }

    return server;
  }