org.glassfish.grizzly.http.server
Class ServerFilterConfiguration

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

public class ServerFilterConfiguration
extends Object

HttpServerFilter configuration.

Author:
Alexey Stashok

Field Summary
static int MAX_REQUEST_PARAMETERS
           
static String USE_SEND_FILE
           
 
Constructor Summary
ServerFilterConfiguration()
           
ServerFilterConfiguration(ServerFilterConfiguration configuration)
           
ServerFilterConfiguration(String serverName, String serverVersion)
           
 
Method Summary
 String getHttpServerName()
           
 String getHttpServerVersion()
           
 int getMaxRequestParameters()
          Returns the maximum number of parameters allowed per request.
 String getScheme()
          Get the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.
 boolean isPassTraceRequest()
           
 boolean isSendFileEnabled()
           Returns true if File resources may be be sent using FileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel).
 boolean isTraceEnabled()
           
 void setHttpServerName(String httpServerName)
          Sets the server name used for HTTP response headers and default generated error pages.
 void setHttpServerVersion(String httpServerVersion)
          Sets the version of the server info sent in HTTP response headers and the default generated error pages.
 void setMaxRequestParameters(int maxRequestParameters)
          Sets the maximum number of parameters allowed for a request.
 void setPassTraceRequest(boolean passTraceRequest)
          If passTraceRequest is true, the TRACE request will be passed to the registered HttpHandlers.
 void setScheme(String scheme)
          Set the HTTP request scheme, which if non-null overrides default one picked up by framework during runtime.
 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).
 void setTraceEnabled(boolean enabled)
          If enabled is true the TRACE method will be respected and a proper response will be generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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:

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

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


Copyright © 2012 Oracle Corporation. All Rights Reserved.