Class ServerFilterConfiguration

java.lang.Object
org.glassfish.grizzly.http.server.ServerFilterConfiguration
Direct Known Subclasses:
ServerConfiguration

public class ServerFilterConfiguration extends Object
HttpServerFilter configuration.
Author:
Alexey Stashok
  • Field Details

  • Constructor Details

    • ServerFilterConfiguration

      public ServerFilterConfiguration()
    • ServerFilterConfiguration

      public ServerFilterConfiguration(String serverName, String serverVersion)
    • ServerFilterConfiguration

      public ServerFilterConfiguration(ServerFilterConfiguration configuration)
  • Method Details

    • 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 to Grizzly.
      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 true if File resources may be be sent using FileChannel.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 of true

      Finally, if the connection between endpoints is secure, send file functionality will be disabled regardless of configuration.

      Returns:
      true if resources will be sent using FileChannel.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 sending File resources via FileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel). If disabled, the more traditional byte[] copy will be used to send content.
      Parameters:
      sendFileEnabled - true to enable FileChannel.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 registered HttpHandlers. 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 configured HttpHandler.
      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 when setPassTraceRequest(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.17
      Returns the "reuse session IDs when creating sessions"
      Since:
      2.2.19
    • setReuseSessionID

      @Deprecated public void setReuseSessionID(boolean isReuseSessionID)
      Deprecated.
      since 2.3.17
      Sets the "reuse session IDs when creating sessions"
      Since:
      2.2.19
    • getMaxPostSize

      public long getMaxPostSize()
      Gets the maximum size of the POST body. -1 value means no size limits applied.
      Since:
      2.3.13
    • setMaxPostSize

      public void setMaxPostSize(long maxPostSize)
      Sets the maximum size of the POST body. -1 value 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. -1 value 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. -1 value means no size limits applied.
      Since:
      2.3
    • getMaxBufferedPostSize

      public int getMaxBufferedPostSize()
      Gets the maximum POST body size, which can buffered in memory. -1 value 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. -1 value 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. null value 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. null value 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 default ErrorPageGenerator.
      Parameters:
      defaultErrorPageGenerator -
    • isGracefulShutdownSupported

      public boolean isGracefulShutdownSupported()
      Returns:
      true, if HttpServerFilter has 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

      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

      public void setSessionManager(SessionManager sessionManager)
      Sets the HTTP server SessionManager.
      Parameters:
      sessionManager - SessionManager