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 String USE_SEND_FILE
           
 
Constructor Summary
ServerFilterConfiguration()
           
ServerFilterConfiguration(ServerFilterConfiguration configuration)
           
ServerFilterConfiguration(String serverName, String serverVersion)
           
 
Method Summary
 String getHttpServerName()
           
 String getHttpServerVersion()
           
 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 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

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.

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.

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.

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


Copyright © 2012 Oracle Corporation. All Rights Reserved.