Top Description Inners Fields Constructors Methods
org.mortbay.jetty.bio

public Class SocketConnector

extends AbstractConnector
Class Inheritance
Imports
java.io.IOException, java.net.InetAddress, .ServerSocket, .Socket, java.util.HashSet, .Iterator, .Set, org.mortbay.io.Buffer, .ByteArrayBuffer, .EndPoint, org.mortbay.io.bio.SocketEndPoint, org.mortbay.jetty.AbstractConnector, .EofException, .HttpConnection, .HttpException, .Request, org.mortbay.log.Log

Socket Connector. This connector implements a traditional blocking IO and threading model. Normal JRE sockets are used and a thread is allocated per connection. Buffers are managed so that large buffers are only allocated to active connections. This Connector should only be used if NIO is not available.
Author
gregw

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
protected Set<E>
protected ServerSocket
Inherited from org.mortbay.jetty.AbstractConnector:
_lowResourceMaxIdleTime_maxIdleTime_soLingerTime

Constructor Summary

AccessConstructor and Description
public
SocketConnector()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
accept(int acceptorID)

Implements abstract org.mortbay.jetty.AbstractConnector.accept.

public void
public void
customize(EndPoint endpoint, Request request)

Overrides org.mortbay.jetty.AbstractConnector.customize.

Implements org.mortbay.jetty.Connector.customize.

Customize a request for an endpoint.
protected void
protected void
public Object
public int
protected Buffer
protected HttpConnection
newHttpConnection(EndPoint endpoint)

Allows subclass to override Conection if required.

protected ServerSocket
newServerSocket(String host, int port, int backlog)

public void
open()

Implements org.mortbay.jetty.Connector.open.

Opens the connector
Inherited from org.mortbay.jetty.AbstractConnector:
checkForwardedHeadersconfigureconnectionClosedconnectionOpenedgetAcceptorPriorityOffsetgetAcceptorsgetAcceptQueueSizegetConfidentialPortgetConfidentialSchemegetConnectionsgetConnectionsDurationAvegetConnectionsDurationMaxgetConnectionsDurationMingetConnectionsDurationTotalgetConnectionsOpengetConnectionsOpenMaxgetConnectionsOpenMingetConnectionsRequestsAvegetConnectionsRequestsMaxgetConnectionsRequestsMingetForwardedForHeadergetForwardedHostHeadergetForwardedServerHeadergetHostgetHostHeadergetIntegralPortgetIntegralSchemegetLeftMostValuegetLowResourceMaxIdleTimegetMaxIdleTimegetNamegetPortgetRequestsgetResolveNamesgetReuseAddressgetServergetSoLingerTimegetStatsOngetStatsOnMsgetThreadPoolisConfidentialisForwardedisIntegraljoinpersistsetAcceptorPriorityOffsetsetAcceptorssetAcceptQueueSizesetConfidentialPortsetConfidentialSchemesetForwardedsetForwardedForHeadersetForwardedHostHeadersetForwardedServerHeadersetHostsetHostHeadersetIntegralPortsetIntegralSchemesetLowResourceMaxIdleTimesetMaxIdleTimesetNamesetPortsetResolveNamessetReuseAddresssetServersetSoLingerTimesetStatsOnsetThreadPoolstatsResetstopAccepttoString

Field Detail

_connectionsback to summary
protected Set<E> _connections

Hides org.mortbay.jetty.AbstractConnector._connections.

_serverSocketback to summary
protected ServerSocket _serverSocket

Constructor Detail

SocketConnectorback to summary
public SocketConnector()

Constructor.

Method Detail

acceptback to summary
public void accept(int acceptorID) throws IOException, InterruptedException

Implements abstract org.mortbay.jetty.AbstractConnector.accept.

closeback to summary
public void close() throws IOException

Implements org.mortbay.jetty.Connector.close.

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

Overrides org.mortbay.jetty.AbstractConnector.customize.

Implements org.mortbay.jetty.Connector.customize.

Doc from org.mortbay.jetty.Connector.customize.

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

doStartback to summary
protected void doStart() throws Exception

Overrides org.mortbay.jetty.AbstractConnector.doStart.

doStopback to summary
protected void doStop() throws Exception

Overrides org.mortbay.jetty.AbstractConnector.doStop.

getConnectionback to summary
public Object getConnection()

Implements org.mortbay.jetty.Connector.getConnection.

Returns:Object

Doc from org.mortbay.jetty.Connector.getConnection.

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

getLocalPortback to summary
public int getLocalPort()

Implements org.mortbay.jetty.Connector.getLocalPort.

Returns:int

Doc from org.mortbay.jetty.Connector.getLocalPort.

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

newBufferback to summary
protected Buffer newBuffer(int size)

Implements abstract org.mortbay.jetty.AbstractBuffers.newBuffer.

newHttpConnectionback to summary
protected HttpConnection newHttpConnection(EndPoint endpoint)

Allows subclass to override Conection if required.

newServerSocketback to summary
protected ServerSocket newServerSocket(String host, int port, int backlog) throws IOException
openback to summary
public void open() throws IOException

Implements org.mortbay.jetty.Connector.open.

Doc from org.mortbay.jetty.Connector.open.

Opens the connector

org.mortbay.jetty.bio back to summary

protected Class SocketConnector.Connection

extends SocketEndPoint
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
pack-priv HttpConnection
pack-priv boolean
protected Socket
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.mortbay.io.bio.SocketEndPoint.close.

Implements org.mortbay.io.EndPoint.close.

Close any backing stream associated with the buffer
public void
public int
fill(Buffer buffer)

Overrides org.mortbay.io.bio.StreamEndPoint.fill.

Implements org.mortbay.io.EndPoint.fill.

Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from org.mortbay.io.bio.SocketEndPoint:
getLocalAddrgetLocalHostgetLocalPortgetRemoteAddrgetRemoteHostgetRemotePortgetTransportisOpen

Field Detail

_connectionback to summary
pack-priv HttpConnection _connection
_dispatchedback to summary
pack-priv boolean _dispatched
_socketback to summary
protected Socket _socket

Hides org.mortbay.io.bio.SocketEndPoint._socket.

_sotimeoutback to summary
pack-priv int _sotimeout

Constructor Detail

Connectionback to summary
public Connection(Socket socket) throws IOException

Method Detail

closeback to summary
public void close() throws IOException

Overrides org.mortbay.io.bio.SocketEndPoint.close.

Implements org.mortbay.io.EndPoint.close.

Doc from org.mortbay.io.EndPoint.close.

Close any backing stream associated with the buffer

dispatchback to summary
public void dispatch() throws InterruptedException, IOException
fillback to summary
public int fill(Buffer buffer) throws IOException

Overrides org.mortbay.io.bio.StreamEndPoint.fill.

Implements org.mortbay.io.EndPoint.fill.

Doc from org.mortbay.io.EndPoint.fill.

Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer. The putIndex is increased if bytes filled. The buffer may chose to do a compact before filling.

Returns:int

an int value indicating the number of bytes filled or -1 if EOF is reached.

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.