Top Description Methods
org.mortbay.jetty

public Interface Connector

extends LifeCycle, Buffers
Known Direct Implementers
org.mortbay.jetty.AbstractConnector
Imports
java.io.IOException, org.mortbay.component.LifeCycle, org.mortbay.io.Buffers, .EndPoint, org.mortbay.util.ajax.Continuation

HTTP Connector. Implementations of this interface provide connectors for the HTTP protocol. A connector receives requests (normally from a socket) and calls the handle method of the Handler object. These operations are performed using threads from the ThreadPool set on the connector. When a connector is registered with an instance of Server, then the server will set itself as both the ThreadPool and the Handler. Note that a connector can be used without a Server if a thread pool and handler are directly provided.
Author
gregw

Method Summary

Modifier and TypeMethod and Description
public void
public void
customize(EndPoint endpoint, Request request)

Customize a request for an endpoint.

public int

Returns:

The port to use when redirecting a request if a data constraint of confidential is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()
getConfidentialPort
()

public String

Returns:

The schema to use when redirecting a request if a data constraint of confidential is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()
getConfidentialScheme
()

public Object

Returns:

the underlying socket, channel, buffer etc. for the connector.
getConnection
()

public int

Returns:

Number of connections accepted by the server since statsReset() called. Undefined if setStatsOn(false).
getConnections
()

public long

Returns:

Average duration in milliseconds of open connections since statsReset() called. Undefined if setStatsOn(false).
getConnectionsDurationAve
()

public long

Returns:

Maximum duration in milliseconds of an open connection since statsReset() called. Undefined if setStatsOn(false).
getConnectionsDurationMax
()

public long

Returns:

Returns the connectionsDurationMin.
getConnectionsDurationMin
()

public long

Returns:

Returns the connectionsDurationTotal.
getConnectionsDurationTotal
()

public int

Returns:

Number of connections currently open that were opened since statsReset() called. Undefined if setStatsOn(false).
getConnectionsOpen
()

public int

Returns:

Maximum number of connections opened simultaneously since statsReset() called. Undefined if setStatsOn(false).
getConnectionsOpenMax
()

public int

Returns:

Returns the connectionsOpenMin.
getConnectionsOpenMin
()

public int

Returns:

Average number of requests per connection since statsReset() called. Undefined if setStatsOn(false).
getConnectionsRequestsAve
()

public int

Returns:

Maximum number of requests per connection since statsReset() called. Undefined if setStatsOn(false).
getConnectionsRequestsMax
()

public int

Returns:

Returns the connectionsRequestsMin.
getConnectionsRequestsMin
()

public int

Returns:

Returns the headerBufferSize.
getHeaderBufferSize
()

public String
public int

Returns:

The port to use when redirecting a request if a data constraint of integral is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()
getIntegralPort
()

public String

Returns:

The schema to use when redirecting a request if a data constraint of integral is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()
getIntegralScheme
()

public int

Returns:

The actual port the connector is listening on or -1 if there is no port or the connector is not open.
getLocalPort
()

public int
public int
public String

Returns:

the name of the connector. Defaults to the HostName:port
getName
()

public int

Returns:

The configured port for the connector or 0 if any available port may be used.
getPort
()

public int

Returns:

Returns the requestBufferSize.
getRequestBufferSize
()

public int

Returns:

Get the number of requests handled by this connector since last call of statsReset(). If setStatsOn(false) then this is undefined.
getRequests
()

public boolean

Returns:

true if names resolution should be done.
getResolveNames
()

public int

Returns:

Returns the responseBufferSize.
getResponseBufferSize
()

public Server
public boolean

Returns:

True if statistics collection is turned on.
getStatsOn
()

public long

Returns:

Timestamp stats were started at.
getStatsOnMs
()

public boolean

Returns:

true if the request is confidential. This normally means the https schema has been used.
isConfidential
(Request
A request
request
)

public boolean

Returns:

true if the request is integral. This normally means the https schema has been used.
isIntegral
(Request
A request
request
)

public Continuation
public void
open()

Opens the connector

public void
persist(EndPoint endpoint)

Persist an endpoint.

public void
setHeaderBufferSize(int
The headerBufferSize to set.
headerBufferSize
)

Set the size of the buffer to be used for request and response headers.

public void
setHost(String hostname)

public void
public void
public void
setPort(int
The port fto listen of for connections or 0 if any available port may be used.
port
)

public void
setRequestBufferSize(int
The requestBufferSize to set.
requestBufferSize
)

Set the size of the content buffer for receiving requests.

public void
setResponseBufferSize(int
The responseBufferSize to set.
responseBufferSize
)

Set the size of the content buffer for sending responses.

public void
setServer(Server server)

public void
setStatsOn(boolean on)

public void
statsReset()

Reset statistics.

Inherited from org.mortbay.component.LifeCycle:
addLifeCycleListenerisFailedisRunningisStartedisStartingisStoppedisStoppingremoveLifeCycleListenerstartstop
Inherited from org.mortbay.io.Buffers:
getBufferreturnBuffer

Method Detail

closeback to summary
public void close() throws IOException
customizeback to summary
public void customize(EndPoint endpoint, Request request) throws IOException

Customize a request for an endpoint. Called on every request to allow customization of the request for the particular endpoint (eg security properties from a SSL connection).

getConfidentialPortback to summary
public int getConfidentialPort()
Returns:int

The port to use when redirecting a request if a data constraint of confidential is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()

getConfidentialSchemeback to summary
public String getConfidentialScheme()
Returns:String

The schema to use when redirecting a request if a data constraint of confidential is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()

getConnectionback to summary
public Object getConnection()
Returns:Object

the underlying socket, channel, buffer etc. for the connector.

getConnectionsback to summary
public int getConnections()
Returns:int

Number of connections accepted by the server since statsReset() called. Undefined if setStatsOn(false).

getConnectionsDurationAveback to summary
public long getConnectionsDurationAve()
Returns:long

Average duration in milliseconds of open connections since statsReset() called. Undefined if setStatsOn(false).

getConnectionsDurationMaxback to summary
public long getConnectionsDurationMax()
Returns:long

Maximum duration in milliseconds of an open connection since statsReset() called. Undefined if setStatsOn(false).

getConnectionsDurationMinback to summary
public long getConnectionsDurationMin()
Returns:long

Returns the connectionsDurationMin.

getConnectionsDurationTotalback to summary
public long getConnectionsDurationTotal()
Returns:long

Returns the connectionsDurationTotal.

getConnectionsOpenback to summary
public int getConnectionsOpen()
Returns:int

Number of connections currently open that were opened since statsReset() called. Undefined if setStatsOn(false).

getConnectionsOpenMaxback to summary
public int getConnectionsOpenMax()
Returns:int

Maximum number of connections opened simultaneously since statsReset() called. Undefined if setStatsOn(false).

getConnectionsOpenMinback to summary
public int getConnectionsOpenMin()
Returns:int

Returns the connectionsOpenMin.

getConnectionsRequestsAveback to summary
public int getConnectionsRequestsAve()
Returns:int

Average number of requests per connection since statsReset() called. Undefined if setStatsOn(false).

getConnectionsRequestsMaxback to summary
public int getConnectionsRequestsMax()
Returns:int

Maximum number of requests per connection since statsReset() called. Undefined if setStatsOn(false).

getConnectionsRequestsMinback to summary
public int getConnectionsRequestsMin()
Returns:int

Returns the connectionsRequestsMin.

getHeaderBufferSizeback to summary
public int getHeaderBufferSize()
Returns:int

Returns the headerBufferSize.

getHostback to summary
public String getHost()
getIntegralPortback to summary
public int getIntegralPort()
Returns:int

The port to use when redirecting a request if a data constraint of integral is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()

getIntegralSchemeback to summary
public String getIntegralScheme()
Returns:String

The schema to use when redirecting a request if a data constraint of integral is required. See org.mortbay.jetty.security.Constraint#getDataConstraint()

getLocalPortback to summary
public int getLocalPort()
Returns:int

The actual port the connector is listening on or -1 if there is no port or the connector is not open.

getLowResourceMaxIdleTimeback to summary
public int getLowResourceMaxIdleTime()
getMaxIdleTimeback to summary
public int getMaxIdleTime()
getNameback to summary
public String getName()
Returns:String

the name of the connector. Defaults to the HostName:port

getPortback to summary
public int getPort()
Returns:int

The configured port for the connector or 0 if any available port may be used.

getRequestBufferSizeback to summary
public int getRequestBufferSize()
Returns:int

Returns the requestBufferSize.

getRequestsback to summary
public int getRequests()
Returns:int

Get the number of requests handled by this connector since last call of statsReset(). If setStatsOn(false) then this is undefined.

getResolveNamesback to summary
public boolean getResolveNames()
Returns:boolean

true if names resolution should be done.

getResponseBufferSizeback to summary
public int getResponseBufferSize()
Returns:int

Returns the responseBufferSize.

getServerback to summary
public Server getServer()
getStatsOnback to summary
public boolean getStatsOn()
Returns:boolean

True if statistics collection is turned on.

getStatsOnMsback to summary
public long getStatsOnMs()
Returns:long

Timestamp stats were started at.

isConfidentialback to summary
public boolean isConfidential(Request request)
Parameters
request:Request

A request

Returns:boolean

true if the request is confidential. This normally means the https schema has been used.

isIntegralback to summary
public boolean isIntegral(Request request)
Parameters
request:Request

A request

Returns:boolean

true if the request is integral. This normally means the https schema has been used.

newContinuationback to summary
public Continuation newContinuation()
openback to summary
public void open() throws IOException

Opens the connector

persistback to summary
public void persist(EndPoint endpoint) throws IOException

Persist an endpoint. Called after every request if the connection is to remain open.

setHeaderBufferSizeback to summary
public void setHeaderBufferSize(int headerBufferSize)

Set the size of the buffer to be used for request and response headers. An idle connection will at most have one buffer of this size allocated.

Parameters
headerBufferSize:int

The headerBufferSize to set.

setHostback to summary
public void setHost(String hostname)
setLowResourceMaxIdleTimeback to summary
public void setLowResourceMaxIdleTime(int ms)
setMaxIdleTimeback to summary
public void setMaxIdleTime(int ms)
setPortback to summary
public void setPort(int port)
Parameters
port:int

The port fto listen of for connections or 0 if any available port may be used.

setRequestBufferSizeback to summary
public void setRequestBufferSize(int requestBufferSize)

Set the size of the content buffer for receiving requests. These buffers are only used for active connections that have requests with bodies that will not fit within the header buffer.

Parameters
requestBufferSize:int

The requestBufferSize to set.

setResponseBufferSizeback to summary
public void setResponseBufferSize(int responseBufferSize)

Set the size of the content buffer for sending responses. These buffers are only used for active connections that are sending responses with bodies that will not fit within the header buffer.

Parameters
responseBufferSize:int

The responseBufferSize to set.

setServerback to summary
public void setServer(Server server)
setStatsOnback to summary
public void setStatsOn(boolean on)
statsResetback to summary
public void statsReset()

Reset statistics.