public class NetworkListener extends Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
NetworkListener(String name)
Constructs a new
NetworkListener using the specified name . |
NetworkListener(String name,
boolean isBindToInherited)
Constructs a new
NetworkListener using the specified name , which,
depending on isBindToInherited will or will not be bound to an inherited Channel. |
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 . |
NetworkListener(String name,
String host,
PortRange portRange)
Constructs a new
NetworkListener using the specified name , host , and
port . |
Modifier and Type | Method and Description |
---|---|
JmxObject |
createManagementObject() |
boolean |
deregisterAddOn(AddOn addon)
Deregisters
AddOn from this NetworkListener. |
AddOn[] |
getAddOns()
Return the array of the registered
AddOn s. |
protected ArraySet<AddOn> |
getAddOnSet()
Returns the direct addons collection, registered on the NetworkListener.
|
String |
getCompressableMimeTypes() |
String |
getCompression() |
int |
getCompressionMinSize() |
FileCache |
getFileCache() |
FilterChain |
getFilterChain() |
String |
getHost() |
HttpCodecFilter |
getHttpCodecFilter() |
HttpServerFilter |
getHttpServerFilter() |
KeepAlive |
getKeepAlive() |
int |
getMaxHttpHeaderSize() |
int |
getMaxPendingBytes() |
int |
getMaxPostSize() |
int |
getMaxRequestHeaders()
Returns the maximum number of headers allowed for a request.
|
int |
getMaxResponseHeaders()
Returns the maximum number of headers allowed for a response.
|
String |
getName() |
String |
getNoCompressionUserAgents() |
int |
getPort() |
PortRange |
getPortRange() |
String |
getRestrictedUserAgents() |
String |
getScheme()
Get the HTTP request scheme, which if non-null overrides default one
picked up by framework during runtime.
|
SSLEngineConfigurator |
getSslEngineConfig() |
int |
getTransactionTimeout() |
TCPNIOTransport |
getTransport() |
int |
getUploadTimeout() |
String |
getUriEncoding() |
boolean |
isAuthPassthroughEnabled() |
boolean |
isChunkingEnabled() |
boolean |
isDisableUploadTimeout() |
boolean |
isPaused() |
boolean |
isRcmSupportEnabled() |
boolean |
isSecure() |
boolean |
isSendFileEnabled() |
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(String compressableMimeTypes) |
void |
setCompression(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 |
setMaxRequestHeaders(int maxRequestHeaders)
Sets the maximum number of headers allowed for a request.
|
void |
setMaxResponseHeaders(int maxResponseHeaders)
Sets the maximum number of headers allowed for a response.
|
void |
setNoCompressionUserAgents(String noCompressionUserAgents) |
void |
setRcmSupportEnabled(boolean enabled) |
void |
setRestrictedUserAgents(String restrictedUserAgents) |
void |
setScheme(String scheme)
Set the HTTP request scheme, which if non-null overrides default one
picked up by framework during runtime.
|
void |
setSecure(boolean secure)
Enable or disable security for this listener.
|
void |
setSendFileEnabled(boolean sendFileEnabled) |
void |
setSSLEngineConfig(SSLEngineConfigurator sslEngineConfig)
Provides customization of the
SSLEngine used by this listener. |
void |
setTraceEnabled(boolean traceEnabled) |
void |
setTransactionTimeout(int transactionTimeout)
Sets the time, in seconds, within which a request must complete its
processing.
|
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(String uriEncoding) |
void |
start()
Starts the listener.
|
void |
stop()
Stops the listener.
|
String |
toString() |
public static final String DEFAULT_NETWORK_HOST
HttpServer
will bind to in order to service HTTP
requests.public static final int DEFAULT_NETWORK_PORT
HttpServer
will bind to in order to service HTTP
requests.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
.
name
- the logical name of the listener.public NetworkListener(String name, boolean isBindToInherited)
Constructs a new NetworkListener
using the specified name
, which,
depending on isBindToInherited
will or will not be bound to an inherited Channel.
name
- the logical name of the listener.isBindToInherited
- if true the NetworkListener
will be
bound to an inherited Channel, otherwise default DEFAULT_NETWORK_HOST
and DEFAULT_NETWORK_PORT
will be used.System.inheritedChannel()
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
.
name
- the logical name of the listener.host
- the network host to which this listener will bind.public NetworkListener(String name, String host, int port)
Constructs a new NetworkListener
using the specified name
, host
, and
port
.
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..public NetworkListener(String name, String host, PortRange portRange)
Constructs a new NetworkListener
using the specified name
, host
, and
port
.
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..public String getName()
public String getHost()
public int getPort()
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.public PortRange getPortRange()
public KeepAlive getKeepAlive()
public TCPNIOTransport getTransport()
TCPNIOTransport
used by this listener.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.
transport
- a custom TCPNIOTransport
implementation.public AddOn[] getAddOns()
AddOn
s.
Please note, possible array modifications wont affect the
NetworkListener
's addons list.AddOn
s.protected ArraySet<AddOn> getAddOnSet()
public boolean deregisterAddOn(AddOn addon)
AddOn
from this NetworkListener.public boolean isChunkingEnabled()
true
if the HTTP response bodies should be chunked if not content length has been explicitly
specified.public void setChunkingEnabled(boolean chunkingEnabled)
chunkingEnabled
- true
to enable chunking; false
to disable.public boolean isSecure()
true
if this is a secure listener, otherwise false
. Listeners are not secure
by default.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.
secure
- if true
this listener will be secure.public String getScheme()
public void setScheme(String scheme)
scheme
- the HTTP request schemepublic int getMaxRequestHeaders()
public void setMaxRequestHeaders(int maxRequestHeaders)
public int getMaxResponseHeaders()
public void setMaxResponseHeaders(int maxResponseHeaders)
public SSLEngineConfigurator getSslEngineConfig()
SSLEngine
configuration for this listener.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.
sslEngineConfig
- custom SSL configuration.public String getCompression()
public void setCompression(String compression)
public int getMaxHttpHeaderSize()
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.
maxHttpHeaderSize
- the maximum header size for an HTTP request.public FilterChain getFilterChain()
FilterChain
used to by the TCPNIOTransport
associated with this listener.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.
filterChain
- the FilterChain
.public int getMaxPendingBytes()
Connection
.
If not explicitly set, the value will be -1 which effectively disables
resource enforcement.public void setMaxPendingBytes(int maxPendingBytes)
Connection
.
If the value is zero or less, then no resource enforcement will take place.maxPendingBytes
- the maximum size, in bytes, of all data waiting to be written to the associated Connection
.public boolean isPaused()
true
if this listener has been paused, otherwise false
public boolean isStarted()
true
if the listener has been started, otherwise false
.public void start() throws IOException
Starts the listener.
IOException
- if an error occurs when attempting to start the listener.public void stop() throws IOException
Stops the listener.
IOException
- if an error occurs when attempting to stop the listener.public void pause() throws IOException
Pauses the listener.
IOException
- if an error occurs when attempting to pause the listener.public void resume() throws IOException
Resumes a paused listener.
IOException
- if an error occurs when attempting to resume the listener.public String toString()
public JmxObject createManagementObject()
public HttpServerFilter getHttpServerFilter()
public HttpCodecFilter getHttpCodecFilter()
public boolean isRcmSupportEnabled()
public void setRcmSupportEnabled(boolean enabled)
public boolean isAuthPassthroughEnabled()
public void setAuthPassthroughEnabled(boolean authPassthroughEnabled)
public String getCompressableMimeTypes()
public void setCompressableMimeTypes(String compressableMimeTypes)
public int getCompressionMinSize()
public void setCompressionMinSize(int compressionMinSize)
public boolean isDisableUploadTimeout()
public void setDisableUploadTimeout(boolean disableUploadTimeout)
public int getMaxPostSize()
public void setMaxPostSize(int maxPostSize)
public String getNoCompressionUserAgents()
public void setNoCompressionUserAgents(String noCompressionUserAgents)
public String getRestrictedUserAgents()
public void setRestrictedUserAgents(String restrictedUserAgents)
public boolean isTraceEnabled()
public void setTraceEnabled(boolean traceEnabled)
public int getUploadTimeout()
public void setUploadTimeout(int uploadTimeout)
public String getUriEncoding()
public void setUriEncoding(String uriEncoding)
public int getTransactionTimeout()
public void setTransactionTimeout(int transactionTimeout)
WorkerThreadIOStrategy
.transactionTimeout
- timeout in secondspublic boolean isSendFileEnabled()
ServerFilterConfiguration.isSendFileEnabled()
public void setSendFileEnabled(boolean sendFileEnabled)
ServerFilterConfiguration.setSendFileEnabled(boolean)
Copyright © 2013 Oracle Corporation. All Rights Reserved.