Tabnine Logo
HttpConfiguration.addCustomizer
Code IndexAdd Tabnine to your IDE (free)

How to use
addCustomizer
method
in
org.eclipse.jetty.server.HttpConfiguration

Best Java code snippets using org.eclipse.jetty.server.HttpConfiguration.addCustomizer (Showing top 20 results out of 1,152)

origin: neo4j/neo4j

@Override
protected HttpConfiguration createHttpConfig()
{
  HttpConfiguration httpConfig = super.createHttpConfig();
  httpConfig.addCustomizer( requestCustomizer );
  return httpConfig;
}
origin: perwendel/spark

private static HttpConnectionFactory createHttpConnectionFactory() {
  HttpConfiguration httpConfig = new HttpConfiguration();
  httpConfig.setSecureScheme("https");
  httpConfig.addCustomizer(new ForwardedRequestCustomizer());
  return new HttpConnectionFactory(httpConfig);
}
origin: apache/nifi

private ServerConnector createConnector(final SslContextFactory sslContextFactory, final Integer listenPort) {
  final ServerConnector serverConnector;
  if (sslContextFactory == null) {
    serverConnector = new ServerConnector(server);
  } else {
    final HttpConfiguration httpsConfiguration = new HttpConfiguration();
    httpsConfiguration.setSecureScheme("https");
    httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
    serverConnector = new ServerConnector(server,
        new SslConnectionFactory(sslContextFactory, "http/1.1"),
        new HttpConnectionFactory(httpsConfiguration));
  }
  serverConnector.setPort(listenPort);
  return serverConnector;
}
origin: apache/nifi

private static Server createServer(Handler handler, int port, KeyStore keyStore, String keyPassword) throws Exception {
  Server server = new Server();
  SslContextFactory sslContextFactory = new SslContextFactory();
  sslContextFactory.setIncludeProtocols("TLSv1.2");
  sslContextFactory.setKeyStore(keyStore);
  sslContextFactory.setKeyManagerPassword(keyPassword);
  HttpConfiguration httpsConfig = new HttpConfiguration();
  httpsConfig.addCustomizer(new SecureRequestCustomizer());
  ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig));
  sslConnector.setPort(port);
  server.addConnector(sslConnector);
  server.setHandler(handler);
  return server;
}
origin: org.springframework.boot/spring-boot

@Override
public void customize(Server server) {
  ForwardedRequestCustomizer customizer = new ForwardedRequestCustomizer();
  for (Connector connector : server.getConnectors()) {
    for (ConnectionFactory connectionFactory : connector
        .getConnectionFactories()) {
      if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) {
        ((HttpConfiguration.ConnectionFactory) connectionFactory)
            .getHttpConfiguration().addCustomizer(customizer);
      }
    }
  }
}
origin: org.springframework.boot/spring-boot

private ServerConnector createConnector(Server server,
    SslContextFactory sslContextFactory, InetSocketAddress address) {
  HttpConfiguration config = new HttpConfiguration();
  config.setSendServerVersion(false);
  config.setSecureScheme("https");
  config.setSecurePort(address.getPort());
  config.addCustomizer(new SecureRequestCustomizer());
  ServerConnector connector = createServerConnector(server, sslContextFactory,
      config);
  connector.setPort(address.getPort());
  connector.setHost(address.getHostString());
  return connector;
}
origin: apache/nifi

private ServerConnector createUnconfiguredSslServerConnector(Server server, HttpConfiguration httpConfiguration, int port) {
  // add some secure config
  final HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
  httpsConfiguration.setSecureScheme("https");
  httpsConfiguration.setSecurePort(port);
  httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
  // build the connector
  return new ServerConnector(server,
      new SslConnectionFactory(createSslContextFactory(), "http/1.1"),
      new HttpConnectionFactory(httpsConfiguration));
}
origin: gocd/gocd

private Connector plainConnector(Jetty9Server server) {
  HttpConfiguration httpConfig = new HttpConfiguration();
  httpConfig.setOutputBufferSize(systemEnvironment.get(SystemEnvironment.RESPONSE_BUFFER_SIZE));
  httpConfig.setSendServerVersion(false);
  httpConfig.addCustomizer(new ForwardedRequestCustomizer());
  ServerConnector httpConnector = new ServerConnector(server.getServer(), new HttpConnectionFactory(httpConfig));
  httpConnector.setHost(systemEnvironment.getListenHost());
  httpConnector.setPort(systemEnvironment.getServerPort());
  httpConnector.setIdleTimeout(systemEnvironment.get(SystemEnvironment.IDLE_TIMEOUT));
  return httpConnector;
}
origin: dropwizard/dropwizard

@Override
protected HttpConfiguration buildHttpConfiguration() {
  final HttpConfiguration config = super.buildHttpConfiguration();
  config.setSecureScheme("https");
  config.setSecurePort(getPort());
  config.addCustomizer(new SecureRequestCustomizer());
  return config;
}
origin: jersey/jersey

config.setSecureScheme("https");
config.setSecurePort(port);
config.addCustomizer(new SecureRequestCustomizer());
origin: yahoo/mysql_perf_analyzer

/**
 * Create ssl connector if https is used
 * @return
 */
private ServerConnector sslConnector() {
  HttpConfiguration http_config = new HttpConfiguration();
  http_config.setSecureScheme("https");
  http_config.setSecurePort(this.getPort());
  
  HttpConfiguration https_config = new HttpConfiguration(http_config);
  https_config.addCustomizer(new SecureRequestCustomizer());
  
  SslContextFactory sslContextFactory = new SslContextFactory(this.getCertKeyStorePath());
  sslContextFactory.setKeyStorePassword(this.getCertKeyStorePassword());
  //exclude weak ciphers
  sslContextFactory.setExcludeCipherSuites("^.*_(MD5|SHA|SHA1)$");
  //only support tlsv1.2
  sslContextFactory.addExcludeProtocols("SSL", "SSLv2", "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1");
  
  ServerConnector connector = new ServerConnector(jettyServer, 
      new SslConnectionFactory(sslContextFactory, "http/1.1"),
      new HttpConnectionFactory(https_config));
  connector.setPort(this.getPort());
  connector.setIdleTimeout(50000);
  return connector;
}

origin: AsyncHttpClient/async-http-client

public static ServerConnector addHttpsConnector(Server server) throws IOException, URISyntaxException {
 String keyStoreFile = resourceAsFile("ssltest-keystore.jks").getAbsolutePath();
 SslContextFactory sslContextFactory = new SslContextFactory(keyStoreFile);
 sslContextFactory.setKeyStorePassword("changeit");
 String trustStoreFile = resourceAsFile("ssltest-cacerts.jks").getAbsolutePath();
 sslContextFactory.setTrustStorePath(trustStoreFile);
 sslContextFactory.setTrustStorePassword("changeit");
 HttpConfiguration httpsConfig = new HttpConfiguration();
 httpsConfig.setSecureScheme("https");
 httpsConfig.addCustomizer(new SecureRequestCustomizer());
 ServerConnector connector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
 server.addConnector(connector);
 return connector;
}
origin: gocd/gocd

httpsConfig.addCustomizer(new SecureRequestCustomizer());
httpsConfig.setSendServerVersion(false);
httpsConfig.addCustomizer(new ForwardedRequestCustomizer());
origin: apache/storm

httpsConfig.addCustomizer(new SecureRequestCustomizer());
if (null != headerBufferSize) {
  httpsConfig.setRequestHeaderSize(headerBufferSize);
origin: jooby-project/jooby

private ServerConnector https(final Server server, final Config conf, final String path,
  final SSLContext sslContext, final boolean http2) {
 HttpConfiguration httpConf = conf(new HttpConfiguration(), conf.withoutPath(CONNECTOR),
   path);
 SslContextFactory sslContextFactory = new SslContextFactory();
 sslContextFactory.setSslContext(sslContext);
 sslContextFactory.setIncludeProtocols("TLSv1.2");
 sslContextFactory.setIncludeCipherSuites("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256");
 HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
 httpsConf.addCustomizer(new SecureRequestCustomizer());
 HttpConnectionFactory https11 = new HttpConnectionFactory(httpsConf);
 if (http2) {
  ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(H2, H2_17, HTTP_1_1);
  alpn.setDefaultProtocol(HTTP_1_1);
  HTTP2ServerConnectionFactory https2 = new HTTP2ServerConnectionFactory(httpsConf);
  ServerConnector connector = new ServerConnector(server,
    new SslConnectionFactory(sslContextFactory, "alpn"), alpn, https2, https11);
  return conf(connector, conf.getConfig(CONNECTOR), path + ".connector");
 } else {
  ServerConnector connector = new ServerConnector(server,
    new SslConnectionFactory(sslContextFactory, HTTP_1_1), https11);
  return conf(connector, conf.getConfig(CONNECTOR), path + ".connector");
 }
}
origin: igniterealtime/Openfire

private Connector createSSLConnector( final Server httpBindServer ) {
  final int securePort = getHttpBindSecurePort();
  try {
    final IdentityStore identityStore = XMPPServer.getInstance().getCertificateStoreManager().getIdentityStore( ConnectionType.BOSH_C2S );
    if (securePort > 0 && identityStore.getStore().aliases().hasMoreElements() ) {
      if ( !identityStore.containsDomainCertificate( ) ) {
        Log.warn("HTTP binding: Using certificates but they are not valid for the hosted domain");
      }
      final ConnectionManagerImpl connectionManager = ((ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager());
      final ConnectionConfiguration configuration = connectionManager.getListener( ConnectionType.BOSH_C2S, true ).generateConnectionConfiguration();
      final SslContextFactory sslContextFactory = new EncryptionArtifactFactory(configuration).getSslContextFactory();
      final HttpConfiguration httpsConfig = new HttpConfiguration();
      httpsConfig.setSecureScheme("https");
      httpsConfig.setSecurePort(securePort);
      configureProxiedConnector(httpsConfig);
      httpsConfig.addCustomizer(new SecureRequestCustomizer());
      final ServerConnector sslConnector = new ServerConnector(httpBindServer, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
      sslConnector.setHost(getBindInterface());
      sslConnector.setPort(securePort);
      return sslConnector;
    }
  }
  catch (Exception e) {
    Log.error("Error creating SSL connector for Http bind", e);
  }
  return null;
}
origin: org.apache.hadoop/hadoop-common

 private ServerConnector createHttpsChannelConnector(
   Server server, HttpConfiguration httpConfig) {
  httpConfig.setSecureScheme(HTTPS_SCHEME);
  httpConfig.addCustomizer(new SecureRequestCustomizer());
  ServerConnector conn = createHttpChannelConnector(server, httpConfig);
  SslContextFactory sslContextFactory = new SslContextFactory();
  sslContextFactory.setNeedClientAuth(needsClientAuth);
  sslContextFactory.setKeyManagerPassword(keyPassword);
  if (keyStore != null) {
   sslContextFactory.setKeyStorePath(keyStore);
   sslContextFactory.setKeyStoreType(keyStoreType);
   sslContextFactory.setKeyStorePassword(keyStorePassword);
  }
  if (trustStore != null) {
   sslContextFactory.setTrustStorePath(trustStore);
   sslContextFactory.setTrustStoreType(trustStoreType);
   sslContextFactory.setTrustStorePassword(trustStorePassword);
  }
  if(null != excludeCiphers && !excludeCiphers.isEmpty()) {
   sslContextFactory.setExcludeCipherSuites(
     StringUtils.getTrimmedStrings(excludeCiphers));
   LOG.info("Excluded Cipher List:" + excludeCiphers);
  }
  conn.addFirstConnectionFactory(new SslConnectionFactory(sslContextFactory,
    HttpVersion.HTTP_1_1.asString()));
  return conn;
 }
}
origin: dropwizard/dropwizard

protected HttpConfiguration buildHttpConfiguration() {
  final HttpConfiguration httpConfig = new HttpConfiguration();
  httpConfig.setHeaderCacheSize((int) headerCacheSize.toBytes());
  httpConfig.setOutputBufferSize((int) outputBufferSize.toBytes());
  httpConfig.setRequestHeaderSize((int) maxRequestHeaderSize.toBytes());
  httpConfig.setResponseHeaderSize((int) maxResponseHeaderSize.toBytes());
  httpConfig.setSendDateHeader(useDateHeader);
  httpConfig.setSendServerVersion(useServerHeader);
  httpConfig.setMinResponseDataRate(minResponseDataPerSecond.toBytes());
  httpConfig.setMinRequestDataRate(minRequestDataPerSecond.toBytes());
  if (useForwardedHeaders) {
    httpConfig.addCustomizer(new ForwardedRequestCustomizer());
  }
  return httpConfig;
}
origin: apache/incubator-druid

https.addCustomizer(new SecureRequestCustomizer());
origin: igniterealtime/Openfire

private void configureProxiedConnector(HttpConfiguration httpConfig) {
  // Check to see if we are deployed behind a proxy
  // Refer to http://eclipse.org/jetty/documentation/current/configuring-connectors.html
  if (isXFFEnabled()) {
    ForwardedRequestCustomizer customizer = new ForwardedRequestCustomizer();
    // default: "X-Forwarded-For"
    String forwardedForHeader = getXFFHeader();
    if (forwardedForHeader != null) {
      customizer.setForwardedForHeader(forwardedForHeader);
    }
    // default: "X-Forwarded-Server"
    String forwardedServerHeader = getXFFServerHeader();
    if (forwardedServerHeader != null) {
      customizer.setForwardedServerHeader(forwardedServerHeader);
    }
    // default: "X-Forwarded-Host"
    String forwardedHostHeader = getXFFHostHeader();
    if (forwardedHostHeader != null) {
      customizer.setForwardedHostHeader(forwardedHostHeader);
    }
    // default: none
    String hostName = getXFFHostName();
    if (hostName != null) {
      customizer.setHostHeader(hostName);
    }
    httpConfig.addCustomizer(customizer);
  }
  httpConfig.setRequestHeaderSize(JiveGlobals.getIntProperty(HTTP_BIND_REQUEST_HEADER_SIZE, HTTP_BIND_REQUEST_HEADER_SIZE_DEFAULT));
}
org.eclipse.jetty.serverHttpConfigurationaddCustomizer

Javadoc

Adds a Customizer that is invoked for every request received.

Customizers are often used to interpret optional headers (eg ForwardedRequestCustomizer) or optional protocol semantics (eg SecureRequestCustomizer).

Popular methods of HttpConfiguration

  • <init>
    Create a configuration from another.
  • setSecureScheme
    Set the URI scheme used for CONFIDENTIAL and INTEGRAL redirections.
  • setSecurePort
    Set the TCP/IP port used for CONFIDENTIAL and INTEGRAL redirections.
  • setSendServerVersion
  • setRequestHeaderSize
    Set the maximum size of a request header.Larger headers will allow for more and/or larger cookies pl
  • setOutputBufferSize
    Set the size of the buffer into which response content is aggregated before being sent to the client
  • setResponseHeaderSize
    Set the maximum size of a response header.Larger headers will allow for more and/or larger cookies a
  • setSendDateHeader
  • setSendXPoweredBy
  • getSecurePort
  • getSecureScheme
  • getSendServerVersion
  • getSecureScheme,
  • getSendServerVersion,
  • setHeaderCacheSize,
  • getCustomizers,
  • getOutputBufferSize,
  • getRequestHeaderSize,
  • getCustomizer,
  • getResponseHeaderSize,
  • getSendDateHeader

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now