org.glassfish.grizzly.http.server
Class NetworkListener

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

public class NetworkListener
extends Object


Field Summary
static 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(String name)
           Constructs a new NetworkListener using the specified name.
NetworkListener(String name, String host)
           Constructs a new NetworkListener using the specified name and host.
NetworkListener(String name, String host, int port)
           Constructs a new NetworkListener using the specified name, host, and port.
 
Method Summary
 JmxObject createManagementObject()
           
 Set<ContentEncoding> getContentEncodings()
           
 FileCache getFileCache()
           
 FilterChain getFilterChain()
           
 String getHost()
           
 HttpCodecFilter getHttpCodecFilter()
           
 HttpServerFilter getHttpServerFilter()
           
 KeepAlive getKeepAlive()
           
 int getMaxHttpHeaderSize()
           
 int getMaxPendingBytes()
           
 String getName()
           
 int getPort()
           
 SSLEngineConfigurator getSslEngineConfig()
           
 TCPNIOTransport getTransport()
           
 boolean isChunkingEnabled()
           
 boolean isPaused()
           
 boolean isSecure()
           
 boolean isStarted()
           
 boolean isWebSocketsEnabled()
           
 void pause()
           Pauses the listener.
 void resume()
           Resumes a paused listener.
 void setChunkingEnabled(boolean chunkingEnabled)
          Enable/disable chunking of an http response body if no content length has been explictly specified.
 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 setSecure(boolean secure)
           Enable or disable security for this listener.
 void setSSLEngineConfig(SSLEngineConfigurator sslEngineConfig)
           Provides customization of the SSLEngine used by this listener.
 void setTransport(TCPNIOTransport transport)
           This allows the developer to specify a custom TCPNIOTransport implementation to be used by this listener.
 void setWebSocketsEnabled(boolean webSocketsEnabled)
          Enables/disables Web Sockets support for this listener.
 void start()
           Starts the listener.
 void stop()
           Stops the listener.
 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 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(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(String name,
                       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(String name,
                       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..
Method Detail

getName

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

getHost

public 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.

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.

isWebSocketsEnabled

public boolean isWebSocketsEnabled()
Returns:
true if Web Sockets is enabled, otherwise, returns false.

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.

setWebSocketsEnabled

public void setWebSocketsEnabled(boolean webSocketsEnabled)
Enables/disables Web Sockets support for this listener.

Parameters:
webSocketsEnabled - true if Web Sockets support should be enabled.

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.

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

setMaxPendingBytes

public void setMaxPendingBytes(int maxPendingBytes)
The maximum size, in bytes, of all data waiting to be written to the associated Connection.

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 IOException

Starts the listener.

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

stop

public void stop()
          throws IOException

Stops the listener.

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

pause

public void pause()
           throws IOException

Pauses the listener.

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

resume

public void resume()
            throws IOException

Resumes a paused listener.

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

toString

public String toString()
Overrides:
toString in class 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()


Copyright © 2010 Oracle Corpration. All Rights Reserved.