org.glassfish.grizzly.http.server
Class NetworkListener

java.lang.Object
  extended by org.glassfish.grizzly.http.server.NetworkListener

public class NetworkListener
extends java.lang.Object


Field Summary
static java.lang.String DEFAULT_NETWORK_HOST
          The default network host to which the HttpServer will bind to in order to service HTTP requests.
static int DEFAULT_NETWORK_PORT
          The default network port to which the HttpServer will bind to in order to service HTTP requests.
 
Constructor Summary
NetworkListener(java.lang.String name)
           Constructs a new NetworkListener using the specified name.
NetworkListener(java.lang.String name, java.lang.String host)
           Constructs a new NetworkListener using the specified name and host.
NetworkListener(java.lang.String name, java.lang.String host, int port)
           Constructs a new NetworkListener using the specified name, host, and port.
NetworkListener(java.lang.String name, java.lang.String host, PortRange portRange)
           Constructs a new NetworkListener using the specified name, host, and port.
 
Method Summary
 JmxObject createManagementObject()
           
 boolean deregisterAddOn(AddOn addon)
          Deregisters AddOn from this NetworkListener.
 AddOn[] getAddOns()
          Return the array of the registered AddOns.
protected  ArraySet<AddOn> getAddOnSet()
          Returns the direct addons collection, registered on the NetworkListener.
 java.lang.String getCompressableMimeTypes()
           
 java.lang.String getCompression()
           
 int getCompressionMinSize()
           
 java.util.Set<ContentEncoding> getContentEncodings()
           
 FileCache getFileCache()
           
 FilterChain getFilterChain()
           
 java.lang.String getHost()
           
 HttpCodecFilter getHttpCodecFilter()
           
 HttpServerFilter getHttpServerFilter()
           
 KeepAlive getKeepAlive()
           
 int getMaxHttpHeaderSize()
           
 int getMaxPendingBytes()
           
 int getMaxPostSize()
           
 java.lang.String getName()
           
 java.lang.String getNoCompressionUserAgents()
           
 int getPort()
           
 PortRange getPortRange()
           
 java.lang.String getRestrictedUserAgents()
           
 SSLEngineConfigurator getSslEngineConfig()
           
 int getTransactionTimeout()
           
 TCPNIOTransport getTransport()
           
 int getUploadTimeout()
           
 java.lang.String getUriEncoding()
           
 boolean isAuthPassthroughEnabled()
           
 boolean isChunkingEnabled()
           
 boolean isDisableUploadTimeout()
           
 boolean isPaused()
           
 boolean isRcmSupportEnabled()
           
 boolean isSecure()
           
 boolean isStarted()
           
 boolean isTraceEnabled()
           
 void pause()
           Pauses the listener.
 boolean registerAddOn(AddOn addon)
          Registers AddOn on this NetworkListener.
 void resume()
           Resumes a paused listener.
 void setAuthPassthroughEnabled(boolean authPassthroughEnabled)
           
 void setChunkingEnabled(boolean chunkingEnabled)
          Enable/disable chunking of an HTTP response body if no content length has been explictly specified.
 void setCompressableMimeTypes(java.lang.String compressableMimeTypes)
           
 void setCompression(java.lang.String compression)
           
 void setCompressionMinSize(int compressionMinSize)
           
 void setDisableUploadTimeout(boolean disableUploadTimeout)
           
 void setFilterChain(FilterChain filterChain)
           Specifies the FilterChain to be used by the TCPNIOTransport associated with this listener.
 void setMaxHttpHeaderSize(int maxHttpHeaderSize)
           Configures the maximum header size for an HTTP request.
 void setMaxPendingBytes(int maxPendingBytes)
          The maximum size, in bytes, of all data waiting to be written to the associated Connection.
 void setMaxPostSize(int maxPostSize)
           
 void setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)
           
 void setRcmSupportEnabled(boolean enabled)
           
 void setRestrictedUserAgents(java.lang.String restrictedUserAgents)
           
 void setSecure(boolean secure)
           Enable or disable security for this listener.
 void setSSLEngineConfig(SSLEngineConfigurator sslEngineConfig)
           Provides customization of the SSLEngine used by this listener.
 void setTraceEnabled(boolean traceEnabled)
           
 void setTransactionTimeout(int transactionTimeout)
           
 void setTransport(TCPNIOTransport transport)
           This allows the developer to specify a custom TCPNIOTransport implementation to be used by this listener.
 void setUploadTimeout(int uploadTimeout)
           
 void setUriEncoding(java.lang.String uriEncoding)
           
 void start()
           Starts the listener.
 void stop()
           Stops the listener.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NETWORK_HOST

public static final java.lang.String DEFAULT_NETWORK_HOST
The default network host to which the HttpServer will bind to in order to service HTTP requests.

See Also:
Constant Field Values

DEFAULT_NETWORK_PORT

public static final int DEFAULT_NETWORK_PORT
The default network port to which the HttpServer will bind to in order to service HTTP requests.

See Also:
Constant Field Values
Constructor Detail

NetworkListener

public NetworkListener(java.lang.String name)

Constructs a new NetworkListener using the specified name. The listener's host and port will default to DEFAULT_NETWORK_HOST and DEFAULT_NETWORK_PORT.

Parameters:
name - the logical name of the listener.

NetworkListener

public NetworkListener(java.lang.String name,
                       java.lang.String host)

Constructs a new NetworkListener using the specified name and host. The listener's port will default to DEFAULT_NETWORK_PORT.

Parameters:
name - the logical name of the listener.
host - the network host to which this listener will bind.

NetworkListener

public NetworkListener(java.lang.String name,
                       java.lang.String host,
                       int port)

Constructs a new NetworkListener using the specified name, host, and port.

Parameters:
name - the logical name of the listener.
host - the network host to which this listener will bind.
port - the network port to which this listener will bind..

NetworkListener

public NetworkListener(java.lang.String name,
                       java.lang.String host,
                       PortRange portRange)

Constructs a new NetworkListener using the specified name, host, and port.

Parameters:
name - the logical name of the listener.
host - the network host to which this listener will bind.
portRange - the network port range to which this listener will bind..
Method Detail

getName

public java.lang.String getName()
Returns:
the logical name of this listener.

getHost

public java.lang.String getHost()
Returns:
the network host to which this listener is configured to bind to.

getPort

public int getPort()
Returns:
the network port to which this listener is configured to bind to. If the HttpServer has not been started yet - the returned value may be: -1, if PortRange will be used to bind the listener; 0, if the port will be assigned by OS; 0 < N < 65536, the port this listener will be bound to. If HttpServer has been started - the value returned is the port the this listener is bound to.

getPortRange

public PortRange getPortRange()
Returns:
the network port range to which this listener is configured to bind to.

getKeepAlive

public KeepAlive getKeepAlive()
Returns:
the configuration for the keep-alive HTTP connections.

getTransport

public TCPNIOTransport getTransport()
Returns:
the TCPNIOTransport used by this listener.

setTransport

public void setTransport(TCPNIOTransport transport)

This allows the developer to specify a custom TCPNIOTransport implementation to be used by this listener.

Attempts to change the transport implementation while the listener is running will be ignored.

Parameters:
transport - a custom TCPNIOTransport implementation.

getAddOns

public AddOn[] getAddOns()
Return the array of the registered AddOns. Please note, possible array modifications wont affect the NetworkListener's addons list.

Returns:
the array of the registered AddOns.

getAddOnSet

protected ArraySet<AddOn> getAddOnSet()
Returns the direct addons collection, registered on the NetworkListener.

Returns:
the direct addons collection, registered on the NetworkListener.

registerAddOn

public boolean registerAddOn(AddOn addon)
Registers AddOn on this NetworkListener.

Parameters:
addon - the AddOn to be registered.
Returns:
true, if the AddOn wasn't registered before, otherwise the existing AddOn will be replaced and this method returns false.

deregisterAddOn

public boolean deregisterAddOn(AddOn addon)
Deregisters AddOn from this NetworkListener.

Parameters:
addon - the AddOn to deregister.
Returns:
true, if the AddOn was successfully removed, or false the the AddOn wasn't registered on the NetworkListener.

isChunkingEnabled

public boolean isChunkingEnabled()
Returns:
true if the HTTP response bodies should be chunked if not content length has been explicitly specified.

setChunkingEnabled

public void setChunkingEnabled(boolean chunkingEnabled)
Enable/disable chunking of an HTTP response body if no content length has been explictly specified. Chunking is enabled by default.

Parameters:
chunkingEnabled - true to enable chunking; false to disable.

isSecure

public boolean isSecure()
Returns:
true if this is a secure listener, otherwise false. Listeners are not secure by default.

setSecure

public void setSecure(boolean secure)

Enable or disable security for this listener.

Attempts to change this value while the listener is running will be ignored.

Parameters:
secure - if true this listener will be secure.

getSslEngineConfig

public SSLEngineConfigurator getSslEngineConfig()
Returns:
the SSLEngine configuration for this listener.

setSSLEngineConfig

public void setSSLEngineConfig(SSLEngineConfigurator sslEngineConfig)

Provides customization of the SSLEngine used by this listener.

Attempts to change this value while the listener is running will be ignored.

Parameters:
sslEngineConfig - custom SSL configuration.

getCompression

public java.lang.String getCompression()

setCompression

public void setCompression(java.lang.String compression)

getMaxHttpHeaderSize

public int getMaxHttpHeaderSize()
Returns:
the maximum header size for an HTTP request.

setMaxHttpHeaderSize

public void setMaxHttpHeaderSize(int maxHttpHeaderSize)

Configures the maximum header size for an HTTP request.

Attempts to change this value while the listener is running will be ignored.

Parameters:
maxHttpHeaderSize - the maximum header size for an HTTP request.

getFilterChain

public FilterChain getFilterChain()
Returns:
the FilterChain used to by the TCPNIOTransport associated with this listener.

setFilterChain

public void setFilterChain(FilterChain filterChain)

Specifies the FilterChain to be used by the TCPNIOTransport associated with this listener.

Attempts to change this value while the listener is running will be ignored.

Parameters:
filterChain - the FilterChain.

getFileCache

public FileCache getFileCache()
Returns:
the FileCache associated with this listener.

getContentEncodings

public java.util.Set<ContentEncoding> getContentEncodings()
Returns:
the set of the supported ContentEncodings.

getMaxPendingBytes

public int getMaxPendingBytes()
Returns:
the maximum size, in bytes, of all data waiting to be written to the associated Connection. If not explicitly set, the value will be -1 which effectively disables resource enforcement.

setMaxPendingBytes

public void setMaxPendingBytes(int maxPendingBytes)
The maximum size, in bytes, of all data waiting to be written to the associated Connection. If the value is zero or less, then no resource enforcement will take place.

Parameters:
maxPendingBytes - the maximum size, in bytes, of all data waiting to be written to the associated Connection.

isPaused

public boolean isPaused()
Returns:
true if this listener has been paused, otherwise false

isStarted

public boolean isStarted()
Returns:
true if the listener has been started, otherwise false.

start

public void start()
           throws java.io.IOException

Starts the listener.

Throws:
java.io.IOException - if an error occurs when attempting to start the listener.

stop

public void stop()
          throws java.io.IOException

Stops the listener.

Throws:
java.io.IOException - if an error occurs when attempting to stop the listener.

pause

public void pause()
           throws java.io.IOException

Pauses the listener.

Throws:
java.io.IOException - if an error occurs when attempting to pause the listener.

resume

public void resume()
            throws java.io.IOException

Resumes a paused listener.

Throws:
java.io.IOException - if an error occurs when attempting to resume the listener.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a value containing the name, host, port, and secure status of this listener.

createManagementObject

public JmxObject createManagementObject()

getHttpServerFilter

public HttpServerFilter getHttpServerFilter()

getHttpCodecFilter

public HttpCodecFilter getHttpCodecFilter()

isRcmSupportEnabled

public boolean isRcmSupportEnabled()

setRcmSupportEnabled

public void setRcmSupportEnabled(boolean enabled)

isAuthPassthroughEnabled

public boolean isAuthPassthroughEnabled()

setAuthPassthroughEnabled

public void setAuthPassthroughEnabled(boolean authPassthroughEnabled)

getCompressableMimeTypes

public java.lang.String getCompressableMimeTypes()

setCompressableMimeTypes

public void setCompressableMimeTypes(java.lang.String compressableMimeTypes)

getCompressionMinSize

public int getCompressionMinSize()

setCompressionMinSize

public void setCompressionMinSize(int compressionMinSize)

isDisableUploadTimeout

public boolean isDisableUploadTimeout()

setDisableUploadTimeout

public void setDisableUploadTimeout(boolean disableUploadTimeout)

getMaxPostSize

public int getMaxPostSize()

setMaxPostSize

public void setMaxPostSize(int maxPostSize)

getNoCompressionUserAgents

public java.lang.String getNoCompressionUserAgents()

setNoCompressionUserAgents

public void setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)

getRestrictedUserAgents

public java.lang.String getRestrictedUserAgents()

setRestrictedUserAgents

public void setRestrictedUserAgents(java.lang.String restrictedUserAgents)

isTraceEnabled

public boolean isTraceEnabled()

setTraceEnabled

public void setTraceEnabled(boolean traceEnabled)

getUploadTimeout

public int getUploadTimeout()

setUploadTimeout

public void setUploadTimeout(int uploadTimeout)

getUriEncoding

public java.lang.String getUriEncoding()

setUriEncoding

public void setUriEncoding(java.lang.String uriEncoding)

getTransactionTimeout

public int getTransactionTimeout()

setTransactionTimeout

public void setTransactionTimeout(int transactionTimeout)


Copyright © 2011 Oracle Corpration. All Rights Reserved.