org.eclipse.jetty.server.bio

## Class SocketConnector

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - org.eclipse.jetty.util.component.AggregateLifeCycle
    - - org.eclipse.jetty.server.AbstractConnector
      - - org.eclipse.jetty.server.bio.SocketConnector

- All Implemented Interfaces:
    HttpBuffers, Connector, Destroyable, Dumpable, LifeCycle
  Direct Known Subclasses:
    Ajp13SocketConnector, SslSocketConnector

      public class SocketConnector
      extends AbstractConnector

  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.
  Apache XBean:
    element="bioConnector" description="Creates a BIO based socket connector"

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `SocketConnector.ConnectorEndPoint`

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<EndPoint>` | `_connections`
    `protected int` | `_localPort`
    `protected ServerSocket` | `_serverSocket`

    - ### Fields inherited from class org.eclipse.jetty.server.AbstractConnector

      `_buffers, _lowResourceMaxIdleTime, _maxIdleTime, _soLingerTime`

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SocketConnector()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(int acceptorID)`
    `void` | `close()`
    `void` | `customize(EndPoint endpoint, Request request)` Customize a request for an endpoint.
    `protected void` | `doStart()` Start the managed lifecycle beans in the order they were added.
    `protected void` | `doStop()` Stop the joined lifecycle beans in the reverse order they were added.
    `void` | `dump(Appendable out, String indent)`
    `Object` | `getConnection()`
    `int` | `getLocalPort()`
    `protected Connection` | `newConnection(EndPoint endpoint)` Allows subclass to override Conection if required.
    `protected ServerSocket` | `newServerSocket(String host, int port, int backlog)`
    `void` | `open()` Opens the connector

    - ### Methods inherited from class org.eclipse.jetty.server.AbstractConnector

      `checkForwardedHeaders, configure, connectionClosed, connectionOpened, connectionUpgraded, getAcceptorPriorityOffset, getAcceptors, getAcceptQueueSize, getConfidentialPort, getConfidentialScheme, getConnections, getConnectionsDurationMax, getConnectionsDurationMean, getConnectionsDurationStdDev, getConnectionsDurationTotal, getConnectionsOpen, getConnectionsOpenMax, getConnectionsRequestsMax, getConnectionsRequestsMean, getConnectionsRequestsStdDev, getForwardedCipherSuiteHeader, getForwardedForHeader, getForwardedHostHeader, getForwardedProtoHeader, getForwardedServerHeader, getForwardedSslSessionIdHeader, getHost, getHostHeader, getIntegralPort, getIntegralScheme, getLeftMostFieldValue, getLowResourceMaxIdleTime, getLowResourcesMaxIdleTime, getMaxBuffers, getMaxIdleTime, getName, getPort, getRequestBuffers, getRequestBufferSize, getRequestBufferType, getRequestHeaderSize, getRequestHeaderType, getRequests, getResolveNames, getResponseBuffers, getResponseBufferSize, getResponseBufferType, getResponseHeaderSize, getResponseHeaderType, getReuseAddress, getServer, getSoLingerTime, getStatsOn, getStatsOnMs, getThreadPool, isConfidential, isForwarded, isIntegral, isLowResources, join, persist, setAcceptorPriorityOffset, setAcceptors, setAcceptQueueSize, setConfidentialPort, setConfidentialScheme, setForwarded, setForwardedCipherSuiteHeader, setForwardedForHeader, setForwardedHostHeader, setForwardedProtoHeader, setForwardedServerHeader, setForwardedSslSessionIdHeader, setHost, setHostHeader, setIntegralPort, setIntegralScheme, setLowResourceMaxIdleTime, setLowResourcesMaxIdleTime, setMaxBuffers, setMaxIdleTime, setName, setPort, setRequestBuffers, setRequestBufferSize, setRequestHeaderSize, setResolveNames, setResponseBuffers, setResponseBufferSize, setResponseHeaderSize, setReuseAddress, setServer, setSoLingerTime, setStatsOn, setThreadPool, statsReset, stopAccept, toString`

    - ### Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle

      `addBean, addBean, contains, destroy, dump, dump, dump, dump, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage`

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

    - ### Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

      `dump`

- - ### Field Detail

    - #### _serverSocket

          protected ServerSocket _serverSocket

    - #### _connections

          protected final Set<EndPoint> _connections

    - #### _localPort

          protected volatile int _localPort

  - ### Constructor Detail

    - #### SocketConnector

          public SocketConnector()

      Constructor.

  - ### Method Detail

    - #### getConnection

          public Object getConnection()

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

    - #### open

          public void open()
                    throws IOException

      Description copied from interface: `Connector`
      Opens the connector
      Throws:
        `IOException`

    - #### newServerSocket

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

      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Throws:
        `IOException`

    - #### accept

          public void accept(int acceptorID)
                      throws IOException,
                             InterruptedException

      Specified by:
        `accept` in class `AbstractConnector`
      Throws:
        `IOException`
        `InterruptedException`

    - #### newConnection

          protected Connection newConnection(EndPoint endpoint)

      Allows subclass to override Conection if required.

    - #### customize

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

      Description copied from interface: `Connector`
      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).
      Specified by:
        `customize` in interface `Connector`
      Overrides:
        `customize` in class `AbstractConnector`
      Throws:
        `IOException`

    - #### getLocalPort

          public int getLocalPort()

      Returns:
        The actual port the connector is listening on or -1 if it has not been opened, or -2 if it has been closed.

    - #### doStart

          protected void doStart()
                          throws Exception

      Description copied from class: `AggregateLifeCycle`
      Start the managed lifecycle beans in the order they were added.
      Overrides:
        `doStart` in class `AbstractConnector`
      Throws:
        `Exception`
      See Also:
        `AbstractLifeCycle.doStart()`

    - #### doStop

          protected void doStop()
                         throws Exception

      Description copied from class: `AggregateLifeCycle`
      Stop the joined lifecycle beans in the reverse order they were added.
      Overrides:
        `doStop` in class `AbstractConnector`
      Throws:
        `Exception`
      See Also:
        `AbstractLifeCycle.doStart()`

    - #### dump

          public void dump(Appendable out,
                  String indent)
                    throws IOException

      Specified by:
        `dump` in interface `Dumpable`
      Overrides:
        `dump` in class `AggregateLifeCycle`
      Throws:
        `IOException`

Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.