public class HttpConnectorFactory extends Object implements ConnectorFactory
Name | Default | Description |
port |
8080 | The TCP/IP port on which to listen for incoming connections. |
bindHost |
(none) | The hostname to bind to. |
inheritChannel |
false | Whether this connector uses a channel inherited from the JVM. Use it with Server::Starter, to launch an instance of Jetty on demand. |
headerCacheSize |
512 bytes | The size of the header field cache. |
outputBufferSize |
32KiB | The size of the buffer into which response content is aggregated before being sent to the client. A larger buffer can improve performance by allowing a content producer to run without blocking, however larger buffers consume more memory and may induce some latency before a client starts processing the content. |
maxRequestHeaderSize |
8KiB | The maximum size of a request header. Larger headers will allow for more and/or larger cookies plus larger form content encoded in a URL. However, larger headers consume more memory and can make a server more vulnerable to denial of service attacks. |
maxResponseHeaderSize |
8KiB | The maximum size of a response header. Larger headers will allow for more and/or larger cookies and longer HTTP headers (eg for redirection). However, larger headers will also consume more memory. |
inputBufferSize |
8KiB | The size of the per-connection input buffer. |
idleTimeout |
30 seconds |
The maximum idle time for a connection, which roughly translates to the
Socket.setSoTimeout(int) call, although with NIO implementations
other mechanisms may be used to implement the timeout.
The max idle time is applied:
|
blockingTimeout |
(none) | The timeout applied to blocking operations. This timeout is in addition to the idleTimeout ,
and applies to the total operation (as opposed to the idle timeout that applies to the time no data
is being sent).
|
minBufferPoolSize |
64 bytes | The minimum size of the buffer pool. |
bufferPoolIncrement |
1KiB | The increment by which the buffer pool should be increased. |
maxBufferPoolSize |
64KiB | The maximum size of the buffer pool. |
acceptorThreads |
(Jetty's default) | The number of worker threads dedicated to accepting connections. By default is max(1, min(4, #CPUs/8)). |
selectorThreads |
(Jetty's default) | The number of worker threads dedicated to sending and receiving data. By default is max(1, min(4, #CPUs/2)). |
acceptQueueSize |
(OS default) | The size of the TCP/IP accept queue for the listening socket. |
reuseAddress |
true | Whether or not SO_REUSEADDR is enabled on the listening socket. |
soLingerTime |
(disabled) | Enable/disable SO_LINGER with the specified linger time. |
useServerHeader |
false | Whether or not to add the Server header to each response. |
useDateHeader |
true | Whether or not to add the Date header to each response. |
useForwardedHeaders |
true |
Whether or not to look at X-Forwarded-* headers added by proxies. See
ForwardedRequestCustomizer for details.
|
httpCompliance |
RFC7230 |
This sets the http compliance level used by Jetty when parsing http, this can be useful when using a
non-RFC7230 compliant front end, such as nginx, which can produce multi-line headers when forwarding
client certificates using proxy_set_header X-SSL-CERT $ssl_client_cert;
Possible values are set forth in the org.eclipse.jetty.http.HttpCompliance enum:
|
Constructor and Description |
---|
HttpConnectorFactory() |
Modifier and Type | Method and Description |
---|---|
static ConnectorFactory |
admin() |
static ConnectorFactory |
application() |
org.eclipse.jetty.server.Connector |
build(org.eclipse.jetty.server.Server server,
com.codahale.metrics.MetricRegistry metrics,
String name,
org.eclipse.jetty.util.thread.ThreadPool threadPool)
Create a new connector.
|
protected org.eclipse.jetty.io.ByteBufferPool |
buildBufferPool() |
protected org.eclipse.jetty.server.ServerConnector |
buildConnector(org.eclipse.jetty.server.Server server,
org.eclipse.jetty.util.thread.Scheduler scheduler,
org.eclipse.jetty.io.ByteBufferPool bufferPool,
String name,
org.eclipse.jetty.util.thread.ThreadPool threadPool,
org.eclipse.jetty.server.ConnectionFactory... factories) |
protected org.eclipse.jetty.server.HttpConfiguration |
buildHttpConfiguration() |
protected org.eclipse.jetty.server.HttpConnectionFactory |
buildHttpConnectionFactory(org.eclipse.jetty.server.HttpConfiguration httpConfig) |
Optional<Integer> |
getAcceptorThreads() |
Integer |
getAcceptQueueSize() |
String |
getBindHost() |
io.dropwizard.util.Duration |
getBlockingTimeout() |
io.dropwizard.util.Size |
getBufferPoolIncrement() |
io.dropwizard.util.Size |
getHeaderCacheSize() |
org.eclipse.jetty.http.HttpCompliance |
getHttpCompliance() |
io.dropwizard.util.Duration |
getIdleTimeout() |
io.dropwizard.util.Size |
getInputBufferSize() |
io.dropwizard.util.Size |
getMaxBufferPoolSize() |
io.dropwizard.util.Size |
getMaxRequestHeaderSize() |
io.dropwizard.util.Size |
getMaxResponseHeaderSize() |
io.dropwizard.util.Size |
getMinBufferPoolSize() |
io.dropwizard.util.Size |
getOutputBufferSize() |
int |
getPort() |
Optional<Integer> |
getSelectorThreads() |
io.dropwizard.util.Duration |
getSoLingerTime() |
protected String |
httpConnections()
Get name of the timer that tracks incoming HTTP connections
|
boolean |
isInheritChannel() |
boolean |
isReuseAddress() |
boolean |
isUseDateHeader() |
boolean |
isUseForwardedHeaders() |
boolean |
isUseServerHeader() |
void |
setAcceptorThreads(Optional<Integer> acceptorThreads) |
void |
setAcceptQueueSize(Integer acceptQueueSize) |
void |
setBindHost(String bindHost) |
void |
setBlockingTimeout(io.dropwizard.util.Duration blockingTimeout) |
void |
setBufferPoolIncrement(io.dropwizard.util.Size bufferPoolIncrement) |
void |
setHeaderCacheSize(io.dropwizard.util.Size headerCacheSize) |
void |
setHttpCompliance(org.eclipse.jetty.http.HttpCompliance httpCompliance) |
void |
setIdleTimeout(io.dropwizard.util.Duration idleTimeout) |
void |
setInheritChannel(boolean inheritChannel) |
void |
setInputBufferSize(io.dropwizard.util.Size inputBufferSize) |
void |
setMaxBufferPoolSize(io.dropwizard.util.Size maxBufferPoolSize) |
void |
setMaxRequestHeaderSize(io.dropwizard.util.Size maxRequestHeaderSize) |
void |
setMaxResponseHeaderSize(io.dropwizard.util.Size maxResponseHeaderSize) |
void |
setMinBufferPoolSize(io.dropwizard.util.Size minBufferPoolSize) |
void |
setOutputBufferSize(io.dropwizard.util.Size outputBufferSize) |
void |
setPort(int port) |
void |
setReuseAddress(boolean reuseAddress) |
void |
setSelectorThreads(Optional<Integer> selectorThreads) |
void |
setSoLingerTime(io.dropwizard.util.Duration soLingerTime) |
void |
setUseDateHeader(boolean useDateHeader) |
void |
setUseForwardedHeaders(boolean useForwardedHeaders) |
void |
setUseServerHeader(boolean useServerHeader) |
public static ConnectorFactory application()
public static ConnectorFactory admin()
public int getPort()
public void setPort(int port)
public String getBindHost()
public void setBindHost(String bindHost)
public boolean isInheritChannel()
public void setInheritChannel(boolean inheritChannel)
public io.dropwizard.util.Size getHeaderCacheSize()
public void setHeaderCacheSize(io.dropwizard.util.Size headerCacheSize)
public io.dropwizard.util.Size getOutputBufferSize()
public void setOutputBufferSize(io.dropwizard.util.Size outputBufferSize)
public io.dropwizard.util.Size getMaxRequestHeaderSize()
public void setMaxRequestHeaderSize(io.dropwizard.util.Size maxRequestHeaderSize)
public io.dropwizard.util.Size getMaxResponseHeaderSize()
public void setMaxResponseHeaderSize(io.dropwizard.util.Size maxResponseHeaderSize)
public io.dropwizard.util.Size getInputBufferSize()
public void setInputBufferSize(io.dropwizard.util.Size inputBufferSize)
public io.dropwizard.util.Duration getIdleTimeout()
public void setIdleTimeout(io.dropwizard.util.Duration idleTimeout)
public io.dropwizard.util.Duration getBlockingTimeout()
public void setBlockingTimeout(io.dropwizard.util.Duration blockingTimeout)
public io.dropwizard.util.Size getMinBufferPoolSize()
public void setMinBufferPoolSize(io.dropwizard.util.Size minBufferPoolSize)
public io.dropwizard.util.Size getBufferPoolIncrement()
public void setBufferPoolIncrement(io.dropwizard.util.Size bufferPoolIncrement)
public io.dropwizard.util.Size getMaxBufferPoolSize()
public void setMaxBufferPoolSize(io.dropwizard.util.Size maxBufferPoolSize)
public Integer getAcceptQueueSize()
public void setAcceptQueueSize(Integer acceptQueueSize)
public boolean isReuseAddress()
public void setReuseAddress(boolean reuseAddress)
public io.dropwizard.util.Duration getSoLingerTime()
public void setSoLingerTime(io.dropwizard.util.Duration soLingerTime)
public boolean isUseServerHeader()
public void setUseServerHeader(boolean useServerHeader)
public boolean isUseDateHeader()
public void setUseDateHeader(boolean useDateHeader)
public boolean isUseForwardedHeaders()
public void setUseForwardedHeaders(boolean useForwardedHeaders)
public org.eclipse.jetty.http.HttpCompliance getHttpCompliance()
public void setHttpCompliance(org.eclipse.jetty.http.HttpCompliance httpCompliance)
public org.eclipse.jetty.server.Connector build(org.eclipse.jetty.server.Server server, com.codahale.metrics.MetricRegistry metrics, String name, org.eclipse.jetty.util.thread.ThreadPool threadPool)
ConnectorFactory
build
in interface ConnectorFactory
server
- the application's Server
instancemetrics
- the application's metricsname
- the application's namethreadPool
- the application's thread poolConnector
protected String httpConnections()
protected org.eclipse.jetty.server.ServerConnector buildConnector(org.eclipse.jetty.server.Server server, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool bufferPool, String name, org.eclipse.jetty.util.thread.ThreadPool threadPool, org.eclipse.jetty.server.ConnectionFactory... factories)
protected org.eclipse.jetty.server.HttpConnectionFactory buildHttpConnectionFactory(org.eclipse.jetty.server.HttpConfiguration httpConfig)
protected org.eclipse.jetty.server.HttpConfiguration buildHttpConfiguration()
protected org.eclipse.jetty.io.ByteBufferPool buildBufferPool()
Copyright © 2017. All rights reserved.