public class HttpConfiguration
extends java.lang.Object
This class is a holder of HTTP configuration for use by the
HttpChannel class. Typically a HTTPConfiguration instance
is instantiated and passed to a ConnectionFactory that can
create HTTP channels (e.g. HTTP, AJP or FCGI).
The configuration held by this class is not for the wire protocol, but for the interpretation and handling of HTTP requests that could be transported by a variety of protocols.
| Modifier and Type | Class and Description |
|---|---|
static interface |
HttpConfiguration.ConnectionFactory |
static interface |
HttpConfiguration.Customizer
An interface that allows a request object to be customized
for a particular HTTP connector configuration.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SERVER_VERSION |
| Constructor and Description |
|---|
HttpConfiguration() |
HttpConfiguration(HttpConfiguration config)
Creates a configuration from another.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCustomizer(HttpConfiguration.Customizer customizer)
Adds a
HttpConfiguration.Customizer that is invoked for every
request received. |
void |
addFormEncodedMethod(java.lang.String method)
Adds a form encoded HTTP Method
|
long |
getBlockingTimeout()
Deprecated.
Replaced by
getMinResponseDataRate() and getMinRequestDataRate() |
CookieCompliance |
getCookieCompliance() |
<T> T |
getCustomizer(java.lang.Class<T> type) |
java.util.List<HttpConfiguration.Customizer> |
getCustomizers() |
java.util.Set<java.lang.String> |
getFormEncodedMethods() |
int |
getHeaderCacheSize() |
long |
getIdleTimeout()
The max idle time is applied to a HTTP request for IO operations and
delayed dispatch.
|
int |
getMaxErrorDispatches() |
long |
getMinRequestDataRate() |
long |
getMinResponseDataRate() |
MultiPartFormDataCompliance |
getMultipartFormDataCompliance() |
int |
getOutputAggregationSize() |
int |
getOutputBufferSize() |
int |
getRequestHeaderSize() |
int |
getResponseHeaderSize() |
int |
getSecurePort() |
java.lang.String |
getSecureScheme() |
boolean |
getSendDateHeader() |
boolean |
getSendServerVersion() |
boolean |
getSendXPoweredBy() |
boolean |
isCookieCompliance(CookieCompliance compliance) |
boolean |
isDelayDispatchUntilContent() |
boolean |
isFormEncodedMethod(java.lang.String method)
Tests whether the HTTP method supports
x-www-form-urlencoded content |
boolean |
isNotifyRemoteAsyncErrors() |
boolean |
isPersistentConnectionsEnabled() |
void |
setBlockingTimeout(long blockingTimeout)
Deprecated.
Replaced by
setMinResponseDataRate(long) and setMinRequestDataRate(long) |
void |
setCookieCompliance(CookieCompliance cookieCompliance) |
void |
setCustomizers(java.util.List<HttpConfiguration.Customizer> customizers)
Sets the
HttpConfiguration.Customizers that are invoked for every
request received. |
void |
setDelayDispatchUntilContent(boolean delay) |
void |
setFormEncodedMethods(java.lang.String... methods)
Sets the form encoded HTTP methods.
|
void |
setHeaderCacheSize(int headerCacheSize) |
void |
setIdleTimeout(long timeoutMs)
The max idle time is applied to a HTTP request for IO operations and
delayed dispatch.
|
void |
setMaxErrorDispatches(int max) |
void |
setMinRequestDataRate(long bytesPerSecond) |
void |
setMinResponseDataRate(long bytesPerSecond)
Sets an minimum response content data rate.
|
void |
setMultiPartFormDataCompliance(MultiPartFormDataCompliance multiPartCompliance)
Sets the compliance level for multipart/form-data handling.
|
void |
setNotifyRemoteAsyncErrors(boolean notifyRemoteAsyncErrors) |
void |
setOutputAggregationSize(int outputAggregationSize)
Set the max size of the response content write that is copied into the aggregate buffer.
|
void |
setOutputBufferSize(int outputBufferSize)
Set the size of the buffer into which response content is aggregated
before being sent to the client.
|
void |
setPersistentConnectionsEnabled(boolean persistentConnectionsEnabled) |
void |
setRequestHeaderSize(int requestHeaderSize)
Larger headers will allow for more and/or larger cookies plus larger form content encoded
in a URL.
|
void |
setResponseHeaderSize(int responseHeaderSize)
Larger headers will allow for more and/or larger cookies and longer HTTP headers (eg for redirection).
|
void |
setSecurePort(int securePort)
Sets the TCP/IP port used for CONFIDENTIAL and INTEGRAL redirections.
|
void |
setSecureScheme(java.lang.String secureScheme)
Set the URI scheme used for CONFIDENTIAL and INTEGRAL redirections.
|
void |
setSendDateHeader(boolean sendDateHeader) |
void |
setSendServerVersion(boolean sendServerVersion) |
void |
setSendXPoweredBy(boolean sendXPoweredBy) |
java.lang.String |
toString() |
void |
writePoweredBy(java.lang.Appendable out,
java.lang.String preamble,
java.lang.String postamble) |
public HttpConfiguration()
public HttpConfiguration(HttpConfiguration config)
config - The configuration to copy.public void addCustomizer(HttpConfiguration.Customizer customizer)
Adds a HttpConfiguration.Customizer that is invoked for every
request received.
Customizers are often used to interpret optional headers (eg ForwardedRequestCustomizer) or
optional protocol semantics (eg SecureRequestCustomizer).
customizer - A request customizerpublic java.util.List<HttpConfiguration.Customizer> getCustomizers()
public <T> T getCustomizer(java.lang.Class<T> type)
public int getOutputBufferSize()
public int getOutputAggregationSize()
public int getRequestHeaderSize()
public int getResponseHeaderSize()
public int getHeaderCacheSize()
public int getSecurePort()
public java.lang.String getSecureScheme()
public boolean isPersistentConnectionsEnabled()
public long getIdleTimeout()
The max idle time is applied to a HTTP request for IO operations and delayed dispatch.
public void setIdleTimeout(long timeoutMs)
The max idle time is applied to a HTTP request for IO operations and delayed dispatch.
timeoutMs - the max idle time in ms or if == 0 implies an infinite timeout, <0
implies no HTTP channel timeout and the connection timeout is used instead.@Deprecated public long getBlockingTimeout()
getMinResponseDataRate() and getMinRequestDataRate()This timeout is in addition to the Connector.getIdleTimeout(), and applies
to the total operation (as opposed to the idle timeout that applies to the time no
data is being sent). This applies only to blocking operations and does not affect
asynchronous read and write.
@Deprecated public void setBlockingTimeout(long blockingTimeout)
setMinResponseDataRate(long) and setMinRequestDataRate(long)This timeout is in addition to the Connector.getIdleTimeout(), and applies
to the total operation (as opposed to the idle timeout that applies to the time no
data is being sent).This applies only to blocking operations and does not affect
asynchronous read and write.
blockingTimeout - -1, for no blocking timeout (default), 0 for a blocking timeout equal to the
idle timeout; >0 for a timeout in ms applied to the total blocking operation.public void setPersistentConnectionsEnabled(boolean persistentConnectionsEnabled)
public void setSendServerVersion(boolean sendServerVersion)
public boolean getSendServerVersion()
public void writePoweredBy(java.lang.Appendable out,
java.lang.String preamble,
java.lang.String postamble)
throws java.io.IOException
java.io.IOExceptionpublic void setSendXPoweredBy(boolean sendXPoweredBy)
public boolean getSendXPoweredBy()
public void setSendDateHeader(boolean sendDateHeader)
public boolean getSendDateHeader()
public void setDelayDispatchUntilContent(boolean delay)
delay - if true, delay the application dispatch until content is available (default false)public boolean isDelayDispatchUntilContent()
public void setCustomizers(java.util.List<HttpConfiguration.Customizer> customizers)
Sets the HttpConfiguration.Customizers that are invoked for every
request received.
Customizers are often used to interpret optional headers (eg ForwardedRequestCustomizer) or
optional protocol semantics (eg SecureRequestCustomizer).
customizers - the list of customizerspublic void setOutputBufferSize(int outputBufferSize)
outputBufferSize - buffer size in bytes.public void setOutputAggregationSize(int outputAggregationSize)
outputAggregationSize - the max write size that is aggregatedpublic void setRequestHeaderSize(int requestHeaderSize)
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.
requestHeaderSize - the maximum size in bytes of the request headerpublic void setResponseHeaderSize(int responseHeaderSize)
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.
responseHeaderSize - the maximum size in bytes of the response headerpublic void setHeaderCacheSize(int headerCacheSize)
headerCacheSize - The size in bytes of the header field cache.public void setSecurePort(int securePort)
Sets the TCP/IP port used for CONFIDENTIAL and INTEGRAL redirections.
securePort - the secure port to redirect to.public void setSecureScheme(java.lang.String secureScheme)
Set the URI scheme used for CONFIDENTIAL and INTEGRAL redirections.
secureScheme - A scheme string like "https"public void setFormEncodedMethods(java.lang.String... methods)
methods - the HTTP methods of requests that can be decoded as
x-www-form-urlencoded content to be made available via the
Request.getParameter(String) and associated APIspublic java.util.Set<java.lang.String> getFormEncodedMethods()
x-www-form-urlencoded content to be made available via the
Request.getParameter(String) and associated APIspublic void addFormEncodedMethod(java.lang.String method)
method - the HTTP method of requests that can be decoded as
x-www-form-urlencoded content to be made available via the
Request.getParameter(String) and associated APIspublic boolean isFormEncodedMethod(java.lang.String method)
x-www-form-urlencoded contentmethod - the HTTP methodx-www-form-urlencoded content to be made available via the
Request.getParameter(String) and associated APIspublic int getMaxErrorDispatches()
public void setMaxErrorDispatches(int max)
max - The maximum error dispatches for a request to prevent looping on an errorpublic long getMinRequestDataRate()
public void setMinRequestDataRate(long bytesPerSecond)
bytesPerSecond - The minimum request data rate in bytes per second; or <=0 for no limitpublic long getMinResponseDataRate()
public void setMinResponseDataRate(long bytesPerSecond)
Sets an minimum response content data rate.
The value is enforced only approximately - not precisely - due to the fact that for efficiency reasons buffer writes may be comprised of both response headers and response content.
bytesPerSecond - The minimum response data rate in bytes per second; or <=0 for no limitpublic CookieCompliance getCookieCompliance()
public void setCookieCompliance(CookieCompliance cookieCompliance)
public boolean isCookieCompliance(CookieCompliance compliance)
public void setMultiPartFormDataCompliance(MultiPartFormDataCompliance multiPartCompliance)
multiPartCompliance - The multipart/form-data compliance level.public MultiPartFormDataCompliance getMultipartFormDataCompliance()
public void setNotifyRemoteAsyncErrors(boolean notifyRemoteAsyncErrors)
notifyRemoteAsyncErrors - whether remote errors, when detected, are notified to async applicationspublic boolean isNotifyRemoteAsyncErrors()
public java.lang.String toString()
toString in class java.lang.Object