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:
|
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. |
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. |
minResponseDataPerSecond |
0 bytes | The minimum response data rate in bytes per second; or <=0 for no limit |
minRequestDataPerSecond |
0 bytes | The minimum request data rate in bytes per second; or <=0 for no limit |
useForwardedHeaders |
false |
Whether or not to look at X-Forwarded-* headers added by proxies. See
ForwardedRequestCustomizer for details.
|
useProxyProtocol |
false | Enable jetty proxy protocol header support. |
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:
|
requestCookieCompliance |
RFC6265 |
This sets the cookie compliance level used by Jetty when parsing request Cookie headers,
this can be useful when needing to support Version=1 cookies defined in RFC2109 (and continued in
RFC2965) which allows for special/reserved characters (control, separator, et al) to be enclosed within
double quotes when used in a cookie value;
Possible values are set forth in the org.eclipse.jetty.http.CookieCompliance enum:
|
responseCookieCompliance |
RFC6265 |
This sets the cookie compliance level used by Jetty when generating response Set-Cookie headers,
this can be useful when needing to support Version=1 cookies defined in RFC2109 (and continued in
RFC2965) which allows for special/reserved characters (control, separator, et al) to be enclosed within
double quotes when used in a cookie value;
Possible values are set forth in the org.eclipse.jetty.http.CookieCompliance 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() |
DataSize |
getBufferPoolIncrement() |
DataSize |
getHeaderCacheSize() |
org.eclipse.jetty.http.HttpCompliance |
getHttpCompliance() |
Duration |
getIdleTimeout() |
DataSize |
getInputBufferSize() |
DataSize |
getMaxBufferPoolSize() |
DataSize |
getMaxRequestHeaderSize() |
DataSize |
getMaxResponseHeaderSize() |
DataSize |
getMinBufferPoolSize() |
DataSize |
getMinRequestDataPerSecond() |
DataSize |
getMinResponseDataPerSecond() |
DataSize |
getOutputBufferSize() |
int |
getPort() |
org.eclipse.jetty.http.CookieCompliance |
getRequestCookieCompliance() |
org.eclipse.jetty.http.CookieCompliance |
getResponseCookieCompliance() |
Optional<Integer> |
getSelectorThreads() |
protected String |
httpConnections()
Get name of the timer that tracks incoming HTTP connections
|
boolean |
isInheritChannel() |
boolean |
isReuseAddress() |
boolean |
isUseDateHeader() |
boolean |
isUseForwardedHeaders() |
boolean |
isUseProxyProtocol() |
boolean |
isUseServerHeader() |
void |
setAcceptorThreads(Optional<Integer> acceptorThreads) |
void |
setAcceptQueueSize(Integer acceptQueueSize) |
void |
setBindHost(String bindHost) |
void |
setBufferPoolIncrement(DataSize bufferPoolIncrement) |
void |
setHeaderCacheSize(DataSize headerCacheSize) |
void |
setHttpCompliance(org.eclipse.jetty.http.HttpCompliance httpCompliance) |
void |
setIdleTimeout(Duration idleTimeout) |
void |
setInheritChannel(boolean inheritChannel) |
void |
setInputBufferSize(DataSize inputBufferSize) |
void |
setMaxBufferPoolSize(DataSize maxBufferPoolSize) |
void |
setMaxRequestHeaderSize(DataSize maxRequestHeaderSize) |
void |
setMaxResponseHeaderSize(DataSize maxResponseHeaderSize) |
void |
setMinBufferPoolSize(DataSize minBufferPoolSize) |
void |
setMinRequestDataPerSecond(DataSize minRequestDataPerSecond) |
void |
setMinResponseDataPerSecond(DataSize minResponseDataPerSecond) |
void |
setOutputBufferSize(DataSize outputBufferSize) |
void |
setPort(int port) |
void |
setRequestCookieCompliance(org.eclipse.jetty.http.CookieCompliance requestCookieCompliance) |
void |
setResponseCookieCompliance(org.eclipse.jetty.http.CookieCompliance responseCookieCompliance) |
void |
setReuseAddress(boolean reuseAddress) |
void |
setSelectorThreads(Optional<Integer> selectorThreads) |
void |
setUseDateHeader(boolean useDateHeader) |
void |
setUseForwardedHeaders(boolean useForwardedHeaders) |
void |
setUseProxyProtocol(boolean useProxyProtocol) |
void |
setUseServerHeader(boolean useServerHeader) |
public static ConnectorFactory application()
public static ConnectorFactory admin()
public int getPort()
public void setPort(int port)
public void setBindHost(String bindHost)
public boolean isInheritChannel()
public void setInheritChannel(boolean inheritChannel)
public DataSize getHeaderCacheSize()
public void setHeaderCacheSize(DataSize headerCacheSize)
public DataSize getOutputBufferSize()
public void setOutputBufferSize(DataSize outputBufferSize)
public DataSize getMaxRequestHeaderSize()
public void setMaxRequestHeaderSize(DataSize maxRequestHeaderSize)
public DataSize getMaxResponseHeaderSize()
public void setMaxResponseHeaderSize(DataSize maxResponseHeaderSize)
public DataSize getInputBufferSize()
public void setInputBufferSize(DataSize inputBufferSize)
public Duration getIdleTimeout()
public void setIdleTimeout(Duration idleTimeout)
public DataSize getMinBufferPoolSize()
public void setMinBufferPoolSize(DataSize minBufferPoolSize)
public DataSize getBufferPoolIncrement()
public void setBufferPoolIncrement(DataSize bufferPoolIncrement)
public DataSize getMaxBufferPoolSize()
public void setMaxBufferPoolSize(DataSize maxBufferPoolSize)
public DataSize getMinResponseDataPerSecond()
public void setMinResponseDataPerSecond(DataSize minResponseDataPerSecond)
public DataSize getMinRequestDataPerSecond()
public void setMinRequestDataPerSecond(DataSize minRequestDataPerSecond)
public void setAcceptQueueSize(Integer acceptQueueSize)
public boolean isReuseAddress()
public void setReuseAddress(boolean reuseAddress)
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 boolean isUseProxyProtocol()
public void setUseProxyProtocol(boolean useProxyProtocol)
public org.eclipse.jetty.http.HttpCompliance getHttpCompliance()
public void setHttpCompliance(org.eclipse.jetty.http.HttpCompliance httpCompliance)
public org.eclipse.jetty.http.CookieCompliance getRequestCookieCompliance()
public void setRequestCookieCompliance(org.eclipse.jetty.http.CookieCompliance requestCookieCompliance)
public org.eclipse.jetty.http.CookieCompliance getResponseCookieCompliance()
public void setResponseCookieCompliance(org.eclipse.jetty.http.CookieCompliance responseCookieCompliance)
public org.eclipse.jetty.server.Connector build(org.eclipse.jetty.server.Server server, com.codahale.metrics.MetricRegistry metrics, String name, @Nullable 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, @Nullable 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 © 2011. All rights reserved.