/** * Constructor with an {@link JettyResourceFactory} that will manage shared resources. * @param resourceFactory the {@link JettyResourceFactory} to use * @param customizer the lambda used to customize the {@link HttpClient} */ public JettyClientHttpConnector( JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) { HttpClient httpClient = new HttpClient(); httpClient.setExecutor(resourceFactory.getExecutor()); httpClient.setByteBufferPool(resourceFactory.getByteBufferPool()); httpClient.setScheduler(resourceFactory.getScheduler()); if (customizer != null) { customizer.accept(httpClient); } this.httpClient = httpClient; }
/** * Constructor with an {@link JettyResourceFactory} that will manage shared resources. * @param resourceFactory the {@link JettyResourceFactory} to use * @param customizer the lambda used to customize the {@link HttpClient} */ public JettyClientHttpConnector( JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) { HttpClient httpClient = new HttpClient(); httpClient.setExecutor(resourceFactory.getExecutor()); httpClient.setByteBufferPool(resourceFactory.getByteBufferPool()); httpClient.setScheduler(resourceFactory.getScheduler()); if (customizer != null) { customizer.accept(httpClient); } this.httpClient = httpClient; }
private AbstractConnector createConnector(InetSocketAddress address, Server server) { ServerConnector connector; JettyResourceFactory resourceFactory = getResourceFactory(); if (resourceFactory != null) { connector = new ServerConnector(server, resourceFactory.getExecutor(), resourceFactory.getScheduler(), resourceFactory.getByteBufferPool(), this.acceptors, this.selectors, new HttpConnectionFactory()); } else { connector = new ServerConnector(server, this.acceptors, this.selectors); } connector.setHost(address.getHostString()); connector.setPort(address.getPort()); for (ConnectionFactory connectionFactory : connector.getConnectionFactories()) { if (connectionFactory instanceof HttpConfiguration.ConnectionFactory) { ((HttpConfiguration.ConnectionFactory) connectionFactory) .getHttpConfiguration().setSendServerVersion(false); } } return connector; }
/** * Constructor with an {@link JettyResourceFactory} that will manage shared resources. * @param resourceFactory the {@link JettyResourceFactory} to use * @param customizer the lambda used to customize the {@link HttpClient} */ public JettyClientHttpConnector( JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) { HttpClient httpClient = new HttpClient(); httpClient.setExecutor(resourceFactory.getExecutor()); httpClient.setByteBufferPool(resourceFactory.getByteBufferPool()); httpClient.setScheduler(resourceFactory.getScheduler()); if (customizer != null) { customizer.accept(httpClient); } this.httpClient = httpClient; }
/** * Constructor with an {@link JettyResourceFactory} that will manage shared resources. * @param resourceFactory the {@link JettyResourceFactory} to use * @param customizer the lambda used to customize the {@link HttpClient} */ public JettyClientHttpConnector( JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) { HttpClient httpClient = new HttpClient(); httpClient.setExecutor(resourceFactory.getExecutor()); httpClient.setByteBufferPool(resourceFactory.getByteBufferPool()); httpClient.setScheduler(resourceFactory.getScheduler()); if (customizer != null) { customizer.accept(httpClient); } this.httpClient = httpClient; }