Class ServerFilterConfiguration
- java.lang.Object
-
- org.glassfish.grizzly.http.server.ServerFilterConfiguration
-
- Direct Known Subclasses:
ServerConfiguration
public class ServerFilterConfiguration extends Object
HttpServerFilterconfiguration.- Author:
- Alexey Stashok
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_REQUEST_PARAMETERSstatic StringUSE_SEND_FILE
-
Constructor Summary
Constructors Constructor Description ServerFilterConfiguration()ServerFilterConfiguration(String serverName, String serverVersion)ServerFilterConfiguration(ServerFilterConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BackendConfigurationgetBackendConfiguration()ErrorPageGeneratorgetDefaultErrorPageGenerator()CharsetgetDefaultQueryEncoding()StringgetHttpServerName()StringgetHttpServerVersion()intgetMaxBufferedPostSize()Gets the maximum POST body size, which can buffered in memory.intgetMaxFormPostSize()Gets the maximum size of the POST body generated by an HTML form.longgetMaxPostSize()Gets the maximum size of the POST body.intgetMaxRequestParameters()Returns the maximum number of parameters allowed per request.StringgetScheme()Get the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.SessionManagergetSessionManager()intgetSessionTimeoutSeconds()Returns the maximum time interval, in seconds, that the HTTP server will keep this session open between client accesses.booleanisGracefulShutdownSupported()booleanisPassTraceRequest()booleanisReuseSessionID()Deprecated.since 2.3.17booleanisSendFileEnabled()Returnstrueif File resources may be be sent usingFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel).booleanisTraceEnabled()voidsetBackendConfiguration(BackendConfiguration backendConfiguration)Sets the auxiliary configuration, which might be used, when Grizzly HttpServer is running behind HTTP gateway like reverse proxy or load balancer.voidsetDefaultErrorPageGenerator(ErrorPageGenerator defaultErrorPageGenerator)Sets the defaultErrorPageGenerator.voidsetDefaultQueryEncoding(Charset defaultQueryEncoding)Sets the default character encoding used to decode request URI's query part.voidsetGracefulShutdownSupported(boolean isGracefulShutdownSupported)Enables or disables graceful shutdown support.voidsetHttpServerName(String httpServerName)Sets the server name used for HTTP response headers and default generated error pages.voidsetHttpServerVersion(String httpServerVersion)Sets the version of the server info sent in HTTP response headers and the default generated error pages.voidsetMaxBufferedPostSize(int maxBufferedPostSize)Sets the maximum POST body size, which can buffered in memory.voidsetMaxFormPostSize(int maxFormPostSize)Sets the maximum size of the POST body generated by an HTML form.voidsetMaxPostSize(long maxPostSize)Sets the maximum size of the POST body.voidsetMaxRequestParameters(int maxRequestParameters)Sets the maximum number of parameters allowed for a request.voidsetPassTraceRequest(boolean passTraceRequest)If passTraceRequest is true, the TRACE request will be passed to the registeredHttpHandlers.voidsetReuseSessionID(boolean isReuseSessionID)Deprecated.since 2.3.17voidsetScheme(String scheme)Set the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.voidsetSendFileEnabled(boolean sendFileEnabled)Configure whether or sendfile support will enabled which allows sendingFileresources viaFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel).voidsetSessionManager(SessionManager sessionManager)Sets the HTTP serverSessionManager.voidsetSessionTimeoutSeconds(int sessionTimeoutSeconds)Specifies the time, in seconds, between client requests before the HTTP server will invalidate this session.voidsetTraceEnabled(boolean enabled)If enabled is true the TRACE method will be respected and a proper response will be generated.
-
-
-
Field Detail
-
MAX_REQUEST_PARAMETERS
public static final int MAX_REQUEST_PARAMETERS
- See Also:
- Constant Field Values
-
USE_SEND_FILE
public static final String USE_SEND_FILE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerFilterConfiguration
public ServerFilterConfiguration()
-
ServerFilterConfiguration
public ServerFilterConfiguration(String serverName, String serverVersion)
-
ServerFilterConfiguration
public ServerFilterConfiguration(ServerFilterConfiguration configuration)
-
-
Method Detail
-
getHttpServerName
public String getHttpServerName()
- Returns:
- the server name used for headers and default error pages.
-
setHttpServerName
public void setHttpServerName(String httpServerName)
Sets the server name used for HTTP response headers and default generated error pages. If not value is explicitly set, this value defaults toGrizzly.- Parameters:
httpServerName- server name
-
getHttpServerVersion
public String getHttpServerVersion()
- Returns:
- the version of this server used for headers and default error pages.
-
setHttpServerVersion
public void setHttpServerVersion(String httpServerVersion)
Sets the version of the server info sent in HTTP response headers and the default generated error pages. If not value is explicitly set, this value defaults to the current version of the Grizzly runtime.- Parameters:
httpServerVersion- server version
-
isSendFileEnabled
public boolean isSendFileEnabled()
Returns
trueif File resources may be be sent usingFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel).By default, this property will be true, except in the following cases:
- JVM OS is HP-UX
- JVM OS is Linux, and the Oracle JVM in use is 1.6.0_17 or older
This logic can be overridden by explicitly setting the property via
setSendFileEnabled(boolean)or by specifying the system property "org.glassfish.grizzly.http.USE_SEND_FILE" with a value oftrueFinally, if the connection between endpoints is secure, send file functionality will be disabled regardless of configuration.
- Returns:
trueif resources will be sent usingFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel).- Since:
- 2.2
-
setSendFileEnabled
public void setSendFileEnabled(boolean sendFileEnabled)
Configure whether or sendfile support will enabled which allows sendingFileresources viaFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel). If disabled, the more traditional byte[] copy will be used to send content.- Parameters:
sendFileEnabled-trueto enableFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel)support.- Since:
- 2.2
-
getScheme
public String getScheme()
Get the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.- Returns:
- the HTTP request scheme
- Since:
- 2.2.4
-
setScheme
public void setScheme(String scheme)
Set the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.- Parameters:
scheme- the HTTP request scheme- Since:
- 2.2.4
-
getBackendConfiguration
public BackendConfiguration getBackendConfiguration()
- Returns:
- the auxiliary configuration, which might be used, when Grizzly HttpServer is running behind HTTP gateway like reverse proxy or load balancer.
- Since:
- 2.3.18
-
setBackendConfiguration
public void setBackendConfiguration(BackendConfiguration backendConfiguration)
Sets the auxiliary configuration, which might be used, when Grizzly HttpServer is running behind HTTP gateway like reverse proxy or load balancer.- Parameters:
backendConfiguration-BackendConfiguration- Since:
- 2.3.18
-
isPassTraceRequest
public boolean isPassTraceRequest()
- Returns:
- true if the TRACE request will be passed to the registered
HttpHandlers, otherwise false if the TRACE request will be handled by Grizzly. - Since:
- 2.2.7
-
setPassTraceRequest
public void setPassTraceRequest(boolean passTraceRequest)
If passTraceRequest is true, the TRACE request will be passed to the registeredHttpHandlers. Otherwise, TRACE will be handled by Grizzly. By default, TRACE requests will be handled by Grizzly.- Parameters:
passTraceRequest- boolean to configure if trace requests will be handled by Grizzly or by a configuredHttpHandler.- Since:
- 2.2.7
-
isTraceEnabled
public boolean isTraceEnabled()
- Returns:
- true if a proper response to HTTP TRACE is to be generated, or false if a 405 is to be returned instead.
- Since:
- 2.2.7
-
setTraceEnabled
public void setTraceEnabled(boolean enabled)
If enabled is true the TRACE method will be respected and a proper response will be generated. Otherwise, the method will be considered as not allowed and an HTTP 405 will be returned. This method only comes into effect whensetPassTraceRequest(false)has been called.- Parameters:
enabled- boolean to configure how grizzly handles TRACE requests- Since:
- 2.2.7
-
getMaxRequestParameters
public int getMaxRequestParameters()
Returns the maximum number of parameters allowed per request. If the value is less than zero, then there will be no limit on parameters. By default, the limit imposed is 10000.- Returns:
- the maximum number of parameters, or -1 if there is no imposed limit.
- Since:
- 2.2.8
-
setMaxRequestParameters
public void setMaxRequestParameters(int maxRequestParameters)
Sets the maximum number of parameters allowed for a request.- Parameters:
maxRequestParameters- the maximum number of parameters.- Since:
- 2.2.8
-
isReuseSessionID
@Deprecated public boolean isReuseSessionID()
Deprecated.since 2.3.17Returns the "reuse session IDs when creating sessions"- Since:
- 2.2.19
-
setReuseSessionID
@Deprecated public void setReuseSessionID(boolean isReuseSessionID)
Deprecated.since 2.3.17Sets the "reuse session IDs when creating sessions"- Since:
- 2.2.19
-
getMaxPostSize
public long getMaxPostSize()
Gets the maximum size of the POST body.-1value means no size limits applied.- Since:
- 2.3.13
-
setMaxPostSize
public void setMaxPostSize(long maxPostSize)
Sets the maximum size of the POST body.-1value means no size limits applied.- Since:
- 2.3.13
-
getMaxFormPostSize
public int getMaxFormPostSize()
Gets the maximum size of the POST body generated by an HTML form.-1value means no size limits applied.- Since:
- 2.3
-
setMaxFormPostSize
public void setMaxFormPostSize(int maxFormPostSize)
Sets the maximum size of the POST body generated by an HTML form.-1value means no size limits applied.- Since:
- 2.3
-
getMaxBufferedPostSize
public int getMaxBufferedPostSize()
Gets the maximum POST body size, which can buffered in memory.-1value means no size limits applied.- Since:
- 2.3
-
setMaxBufferedPostSize
public void setMaxBufferedPostSize(int maxBufferedPostSize)
Sets the maximum POST body size, which can buffered in memory.-1value means no size limits applied.- Since:
- 2.3
-
getDefaultQueryEncoding
public Charset getDefaultQueryEncoding()
- Returns:
- the default character encoding used to decode request URI's query part.
nullvalue means specific request's character encoding will be used
-
setDefaultQueryEncoding
public void setDefaultQueryEncoding(Charset defaultQueryEncoding)
Sets the default character encoding used to decode request URI's query part.nullvalue means specific request's character encoding will be used.
-
getDefaultErrorPageGenerator
public ErrorPageGenerator getDefaultErrorPageGenerator()
- Returns:
- the default
ErrorPageGenerator
-
setDefaultErrorPageGenerator
public void setDefaultErrorPageGenerator(ErrorPageGenerator defaultErrorPageGenerator)
Sets the defaultErrorPageGenerator.- Parameters:
defaultErrorPageGenerator-
-
isGracefulShutdownSupported
public boolean isGracefulShutdownSupported()
- Returns:
- true, if
HttpServerFilterhas to support graceful shutdown, or false otherwise
-
setGracefulShutdownSupported
public void setGracefulShutdownSupported(boolean isGracefulShutdownSupported)
Enables or disables graceful shutdown support.- Parameters:
isGracefulShutdownSupported-
-
getSessionTimeoutSeconds
public int getSessionTimeoutSeconds()
Returns the maximum time interval, in seconds, that the HTTP server will keep this session open between client accesses. After this interval, the HTTP server will invalidate the session.A return value of zero or less indicates that the session will never timeout.
- Returns:
- an integer specifying the number of seconds this session remains open between client requests
- See Also:
setSessionTimeoutSeconds(int)
-
setSessionTimeoutSeconds
public void setSessionTimeoutSeconds(int sessionTimeoutSeconds)
Specifies the time, in seconds, between client requests before the HTTP server will invalidate this session.An interval value of zero or less indicates that the session should never timeout.
- Parameters:
sessionTimeoutSeconds- An integer specifying the number of seconds
-
getSessionManager
public SessionManager getSessionManager()
- Returns:
- the HTTP server
SessionManager - See Also:
setSessionManager(org.glassfish.grizzly.http.server.SessionManager)
-
setSessionManager
public void setSessionManager(SessionManager sessionManager)
Sets the HTTP serverSessionManager.- Parameters:
sessionManager-SessionManager
-
-