Search in sources :

Example 1 with ConnectionFactory

use of org.eclipse.jetty.server.HttpConfiguration.ConnectionFactory in project spring-boot by spring-projects.

the class JettyWebServerFactoryCustomizerTests method getRequestHeaderSizes.

private List<Integer> getRequestHeaderSizes(JettyWebServer server) {
    List<Integer> requestHeaderSizes = new ArrayList<>();
    // Start (and directly stop) server to have connectors available
    server.start();
    server.stop();
    Connector[] connectors = server.getServer().getConnectors();
    for (Connector connector : connectors) {
        connector.getConnectionFactories().stream().filter((factory) -> factory instanceof ConnectionFactory).forEach((cf) -> {
            ConnectionFactory factory = (ConnectionFactory) cf;
            HttpConfiguration configuration = factory.getHttpConfiguration();
            requestHeaderSizes.add(configuration.getRequestHeaderSize());
        });
    }
    return requestHeaderSizes;
}
Also used : AbstractConnector(org.eclipse.jetty.server.AbstractConnector) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) ArrayList(java.util.ArrayList) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration) QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) Duration(java.time.Duration) ConfigurationPropertySources(org.springframework.boot.context.properties.source.ConfigurationPropertySources) JettyServletWebServerFactory(org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory) ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) Server(org.eclipse.jetty.server.Server) BlockingArrayQueue(org.eclipse.jetty.util.BlockingArrayQueue) ConnectionFactory(org.eclipse.jetty.server.HttpConfiguration.ConnectionFactory) Bindable(org.springframework.boot.context.properties.bind.Bindable) RequestLog(org.eclipse.jetty.server.RequestLog) SynchronousQueue(java.util.concurrent.SynchronousQueue) RequestLogWriter(org.eclipse.jetty.server.RequestLogWriter) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) BDDMockito.then(org.mockito.BDDMockito.then) IOException(java.io.IOException) BlockingQueue(java.util.concurrent.BlockingQueue) ForwardHeadersStrategy(org.springframework.boot.autoconfigure.web.ServerProperties.ForwardHeadersStrategy) Collectors(java.util.stream.Collectors) File(java.io.File) ThreadPool(org.eclipse.jetty.util.thread.ThreadPool) Test(org.junit.jupiter.api.Test) List(java.util.List) ConfigurableJettyWebServerFactory(org.springframework.boot.web.embedded.jetty.ConfigurableJettyWebServerFactory) TestPropertySourceUtils(org.springframework.test.context.support.TestPropertySourceUtils) CustomRequestLog(org.eclipse.jetty.server.CustomRequestLog) Binder(org.springframework.boot.context.properties.bind.Binder) Connector(org.eclipse.jetty.server.Connector) Jetty(org.springframework.boot.autoconfigure.web.ServerProperties.Jetty) MockEnvironment(org.springframework.mock.env.MockEnvironment) Mockito.mock(org.mockito.Mockito.mock) AbstractConnector(org.eclipse.jetty.server.AbstractConnector) Connector(org.eclipse.jetty.server.Connector) ConnectionFactory(org.eclipse.jetty.server.HttpConfiguration.ConnectionFactory) ArrayList(java.util.ArrayList) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 BlockingQueue (java.util.concurrent.BlockingQueue)1 SynchronousQueue (java.util.concurrent.SynchronousQueue)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 AbstractConnector (org.eclipse.jetty.server.AbstractConnector)1 Connector (org.eclipse.jetty.server.Connector)1 CustomRequestLog (org.eclipse.jetty.server.CustomRequestLog)1 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)1 ConnectionFactory (org.eclipse.jetty.server.HttpConfiguration.ConnectionFactory)1 RequestLog (org.eclipse.jetty.server.RequestLog)1 RequestLogWriter (org.eclipse.jetty.server.RequestLogWriter)1 Server (org.eclipse.jetty.server.Server)1 BlockingArrayQueue (org.eclipse.jetty.util.BlockingArrayQueue)1 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)1