org.apache.geronimo.jetty6.connector
Class JettyConnector

java.lang.Object
  extended by org.apache.geronimo.jetty6.connector.JettyConnector
All Implemented Interfaces:
GBeanLifecycle, JettyWebConnector, NetworkConnector, WebConnector, LazyStatisticsProvider, StatisticsProvider
Direct Known Subclasses:
AJP13Connector, HTTPBlockingConnector, HTTPSelectChannelConnector, HTTPSocketConnector, HTTPSSelectChannelConnector, HTTPSSocketConnector

public abstract class JettyConnector
extends Object
implements GBeanLifecycle, JettyWebConnector, LazyStatisticsProvider

Base class for GBeans for Jetty network connectors (HTTP, HTTPS, AJP, etc.).


Field Summary
static String CONNECTOR_CONTAINER_REFERENCE
           
static GBeanInfo GBEAN_INFO
           
protected  org.mortbay.jetty.AbstractConnector listener
           
 
Constructor Summary
JettyConnector()
          Only used to allow declaration as a reference.
JettyConnector(JettyContainer container, org.mortbay.jetty.AbstractConnector listener, ThreadPool threadPool, String name)
           
JettyConnector(JettyContainer container, ThreadPool threadPool)
           
 
Method Summary
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 int getAcceptQueueSize()
          Gets the maximum number of connections that may be queued while all threads are busy.
 int getBufferSizeBytes()
          Gets the size of the buffer used to handle network data for this connector.
 String getConnectUrl()
          Gets a URL used to connect to the web server via this connector.
abstract  int getDefaultPort()
           
 String getDefaultScheme()
           
 int getHeaderBufferSizeBytes()
          Gets the size of the header buffer used to handle network data for this connector.
 String getHost()
          Gets the hostname/IP that this connector listens on.
 int getLingerMillis()
          Gets the amount of time the socket used by this connector will linger after being closed
 InetSocketAddress getListenAddress()
          Every connector must specify a property of type InetSocketAddress because we use that to identify the network services to print a list during startup.
 int getMaxIdleTimeMs()
           
 int getMaxThreads()
          Gets the maximum number of threads used to service connections from this connector.
 int getPort()
          Gets the network port that this connector listens on.
abstract  String getProtocol()
          Gets the network protocol that this connector handles.
 int getRedirectPort()
          Gets the network port to which traffic will be redirected if this connector handles insecure traffic and the request requires a secure connection.
 Stats getStats()
          Gets the statistics collected for this class.
 boolean isStateManageable()
           
 boolean isStatisticsProvider()
           
 boolean isStatsOn()
           
 boolean isTcpNoDelay()
          Gets whether the TCP_NODELAY flag is set for the sockets used by this connector.
 void resetStats()
          Reset the startTime for all statistics
 void setAcceptQueueSize(int size)
          Sets the maximum number of connections that may be queued while all threads are busy.
 void setBufferSizeBytes(int bytes)
          Gets the size of the buffer used to handle network data for this connector.
 void setHeaderBufferSizeBytes(int size)
          Sets the size of the Header buffer used to handle network data for this connector.
 void setHost(String host)
          Sets the hostname/IP that this connector listens on.
 void setLingerMillis(int millis)
          Sets the amount of time the socket used by this connector will linger after being closed.
 void setMaxIdleTimeMs(int idleTime)
           
 void setMaxThreads(int maxThreads)
          Sets the maximum number of threads used to service connections from this connector.
 void setPort(int port)
          Sets the network port that this connector listens on.
 void setRedirectPort(int port)
          Gets the network port to which traffic will be redirected if this connector handles insecure traffic and the request requires a secure connection.
 void setStatsOn(boolean on)
           
 void setTcpNoDelay(boolean enable)
          Sets whether the TCP_NODELAY flag is set for the sockets used by this connector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTOR_CONTAINER_REFERENCE

public static final String CONNECTOR_CONTAINER_REFERENCE
See Also:
Constant Field Values

listener

protected final org.mortbay.jetty.AbstractConnector listener

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

JettyConnector

public JettyConnector()
Only used to allow declaration as a reference.


JettyConnector

public JettyConnector(JettyContainer container,
                      ThreadPool threadPool)

JettyConnector

public JettyConnector(JettyContainer container,
                      org.mortbay.jetty.AbstractConnector listener,
                      ThreadPool threadPool,
                      String name)
Method Detail

getHost

public String getHost()
Description copied from interface: NetworkConnector
Gets the hostname/IP that this connector listens on.

Specified by:
getHost in interface NetworkConnector

setHost

public void setHost(String host)
             throws UnknownHostException
Description copied from interface: NetworkConnector
Sets the hostname/IP that this connector listens on. This is typically most useful for machines with multiple network cards, but can be used to limit a connector to only listen for connections from the local machine (127.0.0.1). To listen on all available network interfaces, specify an address of 0.0.0.0.

Specified by:
setHost in interface NetworkConnector
Throws:
UnknownHostException

getPort

public int getPort()
Description copied from interface: NetworkConnector
Gets the network port that this connector listens on.

Specified by:
getPort in interface NetworkConnector

setPort

public void setPort(int port)
Description copied from interface: NetworkConnector
Sets the network port that this connector listens on.

Specified by:
setPort in interface NetworkConnector

getHeaderBufferSizeBytes

public int getHeaderBufferSizeBytes()
Description copied from interface: WebConnector
Gets the size of the header buffer used to handle network data for this connector.

Specified by:
getHeaderBufferSizeBytes in interface WebConnector

setHeaderBufferSizeBytes

public void setHeaderBufferSizeBytes(int size)
Description copied from interface: WebConnector
Sets the size of the Header buffer used to handle network data for this connector.

Specified by:
setHeaderBufferSizeBytes in interface WebConnector

getDefaultPort

public abstract int getDefaultPort()

getDefaultScheme

public String getDefaultScheme()

getConnectUrl

public String getConnectUrl()
Description copied from interface: WebConnector
Gets a URL used to connect to the web server via this connector. This is not guaranteed to work (for example, if the server is located behind a proxy), but it should give a reasonable value if possible. The form of the returned String should be http://hostname or http://hostname:port (in other words, suitable for appending a context path).

Specified by:
getConnectUrl in interface WebConnector

getMaxIdleTimeMs

public int getMaxIdleTimeMs()

setMaxIdleTimeMs

public void setMaxIdleTimeMs(int idleTime)

getBufferSizeBytes

public int getBufferSizeBytes()
Description copied from interface: WebConnector
Gets the size of the buffer used to handle network data for this connector.

Specified by:
getBufferSizeBytes in interface WebConnector

setBufferSizeBytes

public void setBufferSizeBytes(int bytes)
Description copied from interface: WebConnector
Gets the size of the buffer used to handle network data for this connector.

Specified by:
setBufferSizeBytes in interface WebConnector

getAcceptQueueSize

public int getAcceptQueueSize()
Description copied from interface: WebConnector
Gets the maximum number of connections that may be queued while all threads are busy. Any requests received while the queue is full will be rejected.

Specified by:
getAcceptQueueSize in interface WebConnector

setAcceptQueueSize

public void setAcceptQueueSize(int size)
Description copied from interface: WebConnector
Sets the maximum number of connections that may be queued while all threads are busy. Any requests received while the queue is full will be rejected.

Specified by:
setAcceptQueueSize in interface WebConnector

getLingerMillis

public int getLingerMillis()
Description copied from interface: WebConnector
Gets the amount of time the socket used by this connector will linger after being closed. -1 indicates that socket linger is disabled.

Specified by:
getLingerMillis in interface WebConnector

setLingerMillis

public void setLingerMillis(int millis)
Description copied from interface: WebConnector
Sets the amount of time the socket used by this connector will linger after being closed. Use -1 to disable socket linger.

Specified by:
setLingerMillis in interface WebConnector

isTcpNoDelay

public boolean isTcpNoDelay()
Description copied from interface: WebConnector
Gets whether the TCP_NODELAY flag is set for the sockets used by this connector. This usually enhances performance, so it should typically be set.

Specified by:
isTcpNoDelay in interface WebConnector

setTcpNoDelay

public void setTcpNoDelay(boolean enable)
Description copied from interface: WebConnector
Sets whether the TCP_NODELAY flag is set for the sockets used by this connector. This usually enhances performance, so it should typically be set.

Specified by:
setTcpNoDelay in interface WebConnector

setMaxThreads

public void setMaxThreads(int maxThreads)
Description copied from interface: WebConnector
Sets the maximum number of threads used to service connections from this connector.

Specified by:
setMaxThreads in interface WebConnector

getMaxThreads

public int getMaxThreads()
Description copied from interface: WebConnector
Gets the maximum number of threads used to service connections from this connector.

Specified by:
getMaxThreads in interface WebConnector

getRedirectPort

public int getRedirectPort()
Description copied from interface: WebConnector
Gets the network port to which traffic will be redirected if this connector handles insecure traffic and the request requires a secure connection. Needless to say, this should point to another connector configured for SSL.

Specified by:
getRedirectPort in interface WebConnector

getListenAddress

public InetSocketAddress getListenAddress()
Description copied from interface: NetworkConnector
Every connector must specify a property of type InetSocketAddress because we use that to identify the network services to print a list during startup. However, this can be read-only since the host and port are set separately using setHost and setPort.

Specified by:
getListenAddress in interface NetworkConnector

setRedirectPort

public void setRedirectPort(int port)
Description copied from interface: WebConnector
Gets the network port to which traffic will be redirected if this connector handles insecure traffic and the request requires a secure connection. Needless to say, this should point to another connector configured for SSL. If no SSL connector is available, any port can be used as they all fail equally well. :)

Specified by:
setRedirectPort in interface WebConnector

getProtocol

public abstract String getProtocol()
Description copied from interface: NetworkConnector
Gets the network protocol that this connector handles.

Specified by:
getProtocol in interface NetworkConnector

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

isStatsOn

public boolean isStatsOn()
Specified by:
isStatsOn in interface LazyStatisticsProvider

setStatsOn

public void setStatsOn(boolean on)
Specified by:
setStatsOn in interface LazyStatisticsProvider

getStats

public Stats getStats()
Gets the statistics collected for this class. The first call to this method initializes the startTime for all statistics.

Specified by:
getStats in interface StatisticsProvider
Returns:
gets collected for this class

resetStats

public void resetStats()
Reset the startTime for all statistics

Specified by:
resetStats in interface StatisticsProvider

isStateManageable

public boolean isStateManageable()

isStatisticsProvider

public boolean isStatisticsProvider()


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.