@ManagedObject(value="HTTP Configuration") public class HttpConfiguration extends 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 String |
SERVER_VERSION |
Constructor and Description |
---|
HttpConfiguration() |
HttpConfiguration(HttpConfiguration config)
Create a configuration from another.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomizer(HttpConfiguration.Customizer customizer)
Add a
HttpConfiguration.Customizer that is invoked for every
request received. |
void |
addFormEncodedMethod(String method)
Add a form encoded HTTP Method
|
long |
getBlockingTimeout()
Get the timeout applied to blocking operations.
|
<T> T |
getCustomizer(Class<T> type) |
List<HttpConfiguration.Customizer> |
getCustomizers() |
Set<String> |
getFormEncodedMethods() |
int |
getHeaderCacheSize() |
int |
getMaxErrorDispatches() |
int |
getOutputAggregationSize() |
int |
getOutputBufferSize() |
int |
getRequestHeaderSize() |
int |
getResponseHeaderSize() |
int |
getSecurePort() |
String |
getSecureScheme() |
boolean |
getSendDateHeader() |
boolean |
getSendServerVersion() |
boolean |
getSendXPoweredBy() |
boolean |
isDelayDispatchUntilContent() |
boolean |
isFormEncodedMethod(String method)
Test if the method type supports
x-www-form-urlencoded content |
boolean |
isPersistentConnectionsEnabled() |
void |
setBlockingTimeout(long blockingTimeout)
Set the timeout applied to blocking operations.
|
void |
setCustomizers(List<HttpConfiguration.Customizer> customizers)
Set the
HttpConfiguration.Customizer s that are invoked for every
request received. |
void |
setDelayDispatchUntilContent(boolean delay) |
void |
setFormEncodedMethods(String... methods)
Set the form encoded methods.
|
void |
setHeaderCacheSize(int headerCacheSize)
Set the header field cache size.
|
void |
setMaxErrorDispatches(int max) |
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)
Set the maximum size of a request header.
|
void |
setResponseHeaderSize(int responseHeaderSize)
Set the maximum size of a response header.
|
void |
setSecurePort(int securePort)
Set the TCP/IP port used for CONFIDENTIAL and INTEGRAL redirections.
|
void |
setSecureScheme(String secureScheme)
Set the URI scheme used for CONFIDENTIAL and INTEGRAL redirections.
|
void |
setSendDateHeader(boolean sendDateHeader) |
void |
setSendServerVersion(boolean sendServerVersion) |
void |
setSendXPoweredBy(boolean sendXPoweredBy) |
String |
toString() |
void |
writePoweredBy(Appendable out,
String preamble,
String postamble) |
public static final String SERVER_VERSION
public HttpConfiguration()
public HttpConfiguration(HttpConfiguration config)
config
- The configuration to copy.public void addCustomizer(HttpConfiguration.Customizer customizer)
Add a HttpConfiguration.Customizer
that is invoked for every
request received.
Customiser are often used to interpret optional headers (eg ForwardedRequestCustomizer
) or
optional protocol semantics (eg SecureRequestCustomizer
).
customizer
- A request customizerpublic List<HttpConfiguration.Customizer> getCustomizers()
public <T> T getCustomizer(Class<T> type)
@ManagedAttribute(value="The size in bytes of the output buffer used to aggregate HTTP output") public int getOutputBufferSize()
@ManagedAttribute(value="The maximum size in bytes for HTTP output to be aggregated") public int getOutputAggregationSize()
@ManagedAttribute(value="The maximum allowed size in bytes for a HTTP request header") public int getRequestHeaderSize()
@ManagedAttribute(value="The maximum allowed size in bytes for a HTTP response header") public int getResponseHeaderSize()
@ManagedAttribute(value="The maximum allowed size in bytes for a HTTP header field cache") public int getHeaderCacheSize()
@ManagedAttribute(value="The port to which Integral or Confidential security constraints are redirected") public int getSecurePort()
@ManagedAttribute(value="The scheme with which Integral or Confidential security constraints are redirected") public String getSecureScheme()
@ManagedAttribute(value="True if HTTP/1 persistent connection are enabled") public boolean isPersistentConnectionsEnabled()
@ManagedAttribute(value="Timeout in MS for blocking operations.") public long getBlockingTimeout()
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).
public void setBlockingTimeout(long blockingTimeout)
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).
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)
@ManagedAttribute(value="if true, send the Server header in responses") public boolean getSendServerVersion()
public void writePoweredBy(Appendable out, String preamble, String postamble) throws IOException
IOException
public void setSendXPoweredBy(boolean sendXPoweredBy)
@ManagedAttribute(value="if true, send the X-Powered-By header in responses") public boolean getSendXPoweredBy()
public void setSendDateHeader(boolean sendDateHeader)
@ManagedAttribute(value="if true, include the date in HTTP headers") public boolean getSendDateHeader()
public void setDelayDispatchUntilContent(boolean delay)
delay
- if true, delay the application dispatch until content is available (default false)@ManagedAttribute(value="if true, delay the application dispatch until content is available") public boolean isDelayDispatchUntilContent()
public void setCustomizers(List<HttpConfiguration.Customizer> customizers)
Set the HttpConfiguration.Customizer
s 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
- Max header size in bytespublic 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
- Response header size in bytes.public void setHeaderCacheSize(int headerCacheSize)
headerCacheSize
- The size in bytes of the header field cache.public void setSecurePort(int securePort)
securePort
- the secure port to redirect to.public void setSecureScheme(String secureScheme)
secureScheme
- A scheme string like "https"public void setFormEncodedMethods(String... methods)
methods
- 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 Set<String> getFormEncodedMethods()
Request.getParameter(String)
and associated APIspublic void addFormEncodedMethod(String method)
method
- 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(String method)
x-www-form-urlencoded
contentmethod
- the method typex-www-form-urlencoded
content to be made available via the
Request.getParameter(String)
and associated APIs@ManagedAttribute(value="The maximum ERROR dispatches for a request for loop prevention (default 10)") public int getMaxErrorDispatches()
public void setMaxErrorDispatches(int max)
max
- The maximum error dispatches for a request to prevent looping on an errorCopyright © 1995-2015 Webtide. All Rights Reserved.