org.eclipse.jetty.server

## Interface Connector

- All Superinterfaces:
    LifeCycle
  All Known Subinterfaces:
    SslConnector
  All Known Implementing Classes:
    AbstractConnector, AbstractNIOConnector, Ajp13SocketConnector, BlockingChannelConnector, InheritedChannelConnector, LocalConnector, NestedConnector, NetworkTrafficSelectChannelConnector, SelectChannelConnector, SocketConnector, SslSelectChannelConnector, SslSocketConnector

      public interface Connector
      extends LifeCycle

  Author:
    gregw

- - ### Nested Class Summary

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

      `LifeCycle.Listener`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `customize(EndPoint endpoint, Request request)` Customize a request for an endpoint.
    `int` | `getConfidentialPort()`
    `String` | `getConfidentialScheme()`
    `Object` | `getConnection()`
    `int` | `getConnections()`
    `long` | `getConnectionsDurationMax()`
    `double` | `getConnectionsDurationMean()`
    `double` | `getConnectionsDurationStdDev()`
    `long` | `getConnectionsDurationTotal()`
    `int` | `getConnectionsOpen()`
    `int` | `getConnectionsOpenMax()`
    `int` | `getConnectionsRequestsMax()`
    `double` | `getConnectionsRequestsMean()`
    `double` | `getConnectionsRequestsStdDev()`
    `String` | `getHost()`
    `int` | `getIntegralPort()`
    `String` | `getIntegralScheme()`
    `int` | `getLocalPort()`
    `int` | `getLowResourceMaxIdleTime()`
    `int` | `getMaxIdleTime()`
    `String` | `getName()`
    `int` | `getPort()`
    `Buffers` | `getRequestBuffers()`
    `int` | `getRequestBufferSize()`
    `int` | `getRequestHeaderSize()`
    `int` | `getRequests()`
    `boolean` | `getResolveNames()`
    `Buffers` | `getResponseBuffers()`
    `int` | `getResponseBufferSize()`
    `int` | `getResponseHeaderSize()`
    `Server` | `getServer()`
    `boolean` | `getStatsOn()`
    `long` | `getStatsOnMs()`
    `boolean` | `isConfidential(Request request)`
    `boolean` | `isIntegral(Request request)`
    `boolean` | `isLowResources()` Check if low on resources.
    `void` | `open()` Opens the connector
    `void` | `persist(EndPoint endpoint)` Persist an endpoint.
    `void` | `setHost(String hostname)` Set the hostname of the interface to bind to.
    `void` | `setLowResourceMaxIdleTime(int ms)`
    `void` | `setMaxIdleTime(int ms)`
    `void` | `setPort(int port)`
    `void` | `setRequestBufferSize(int requestBufferSize)` Set the size of the content buffer for receiving requests.
    `void` | `setRequestHeaderSize(int size)` Set the size of the buffer to be used for request headers.
    `void` | `setResponseBufferSize(int responseBufferSize)` Set the size of the content buffer for sending responses.
    `void` | `setResponseHeaderSize(int size)` Set the size of the buffer to be used for request headers.
    `void` | `setServer(Server server)`
    `void` | `setStatsOn(boolean on)`
    `void` | `statsReset()` Reset statistics.

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

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

- - ### Method Detail

    - #### getName

          String getName()

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

    - #### open

          void open()
                    throws IOException

      Opens the connector
      Throws:
        `IOException`

    - #### close

          void close()
                     throws IOException

      Throws:
        `IOException`

    - #### setServer

          void setServer(Server server)

    - #### getServer

          Server getServer()

    - #### getRequestHeaderSize

          int getRequestHeaderSize()

      Returns:
        Returns the request header buffer size in bytes.

    - #### setRequestHeaderSize

          void setRequestHeaderSize(int size)

      Set the size of the buffer to be used for request headers.
      Parameters:
        `size` - The size in bytes.

    - #### getResponseHeaderSize

          int getResponseHeaderSize()

      Returns:
        Returns the response header buffer size in bytes.

    - #### setResponseHeaderSize

          void setResponseHeaderSize(int size)

      Set the size of the buffer to be used for request headers.
      Parameters:
        `size` - The size in bytes.

    - #### getRequestBuffers

          Buffers getRequestBuffers()

      Returns:
        factory for request buffers

    - #### getResponseBuffers

          Buffers getResponseBuffers()

      Returns:
        factory for response buffers

    - #### getRequestBufferSize

          int getRequestBufferSize()

      Returns:
        Returns the requestBufferSize.

    - #### setRequestBufferSize

          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` - The requestBufferSize to set.

    - #### getResponseBufferSize

          int getResponseBufferSize()

      Returns:
        Returns the responseBufferSize.

    - #### setResponseBufferSize

          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` - The responseBufferSize to set.

    - #### getIntegralPort

          int getIntegralPort()

      Returns:
        The port to use when redirecting a request if a data constraint of integral is required. See `Constraint.getDataConstraint()`

    - #### getIntegralScheme

          String getIntegralScheme()

      Returns:
        The schema to use when redirecting a request if a data constraint of integral is required. See `Constraint.getDataConstraint()`

    - #### isIntegral

          boolean isIntegral(Request request)

      Parameters:
        `request` - A request
      Returns:
        true if the request is integral. This normally means the https schema has been used.

    - #### getConfidentialPort

          int getConfidentialPort()

      Returns:
        The port to use when redirecting a request if a data constraint of confidential is required. See `Constraint.getDataConstraint()`

    - #### getConfidentialScheme

          String getConfidentialScheme()

      Returns:
        The schema to use when redirecting a request if a data constraint of confidential is required. See `Constraint.getDataConstraint()`

    - #### isConfidential

          boolean isConfidential(Request request)

      Parameters:
        `request` - A request
      Returns:
        true if the request is confidential. This normally means the https schema has been used.

    - #### customize

          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).
      Parameters:
        `endpoint` -
        `request` -
      Throws:
        `IOException`

    - #### persist

          void persist(EndPoint endpoint)
                       throws IOException

      Persist an endpoint. Called after every request if the connection is to remain open.
      Parameters:
        `endpoint` -
      Throws:
        `IOException`

    - #### getHost

          String getHost()

      Returns:
        The hostname representing the interface to which this connector will bind, or null for all interfaces.

    - #### setHost

          void setHost(String hostname)

      Set the hostname of the interface to bind to.
      Parameters:
        `hostname` - The hostname representing the interface to which this connector will bind, or null for all interfaces.

    - #### setPort

          void setPort(int port)

      Parameters:
        `port` - The port to listen of for connections or 0 if any available port may be used.

    - #### getPort

          int getPort()

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

    - #### getLocalPort

          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.

    - #### getMaxIdleTime

          int getMaxIdleTime()

      Returns:
        Max Idle time for connections in milliseconds

    - #### setMaxIdleTime

          void setMaxIdleTime(int ms)

      Parameters:
        `ms` - Max Idle time for connections in milliseconds

    - #### getLowResourceMaxIdleTime

          int getLowResourceMaxIdleTime()

    - #### setLowResourceMaxIdleTime

          void setLowResourceMaxIdleTime(int ms)

    - #### getConnection

          Object getConnection()

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

    - #### getResolveNames

          boolean getResolveNames()

      Returns:
        true if names resolution should be done.

    - #### getRequests

          int getRequests()

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

    - #### getConnectionsDurationTotal

          long getConnectionsDurationTotal()

      Returns:
        Returns the connectionsDurationTotal.

    - #### getConnections

          int getConnections()

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

    - #### getConnectionsOpen

          int getConnectionsOpen()

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

    - #### getConnectionsOpenMax

          int getConnectionsOpenMax()

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

    - #### getConnectionsDurationMax

          long getConnectionsDurationMax()

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

    - #### getConnectionsDurationMean

          double getConnectionsDurationMean()

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

    - #### getConnectionsDurationStdDev

          double getConnectionsDurationStdDev()

      Returns:
        Standard deviation of duration in milliseconds of open connections since statsReset() called. Undefined if setStatsOn(false).

    - #### getConnectionsRequestsMean

          double getConnectionsRequestsMean()

      Returns:
        Mean number of requests per connection since statsReset() called. Undefined if setStatsOn(false).

    - #### getConnectionsRequestsStdDev

          double getConnectionsRequestsStdDev()

      Returns:
        Standard Deviation of number of requests per connection since statsReset() called. Undefined if setStatsOn(false).

    - #### getConnectionsRequestsMax

          int getConnectionsRequestsMax()

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

    - #### statsReset

          void statsReset()

      Reset statistics.

    - #### setStatsOn

          void setStatsOn(boolean on)

    - #### getStatsOn

          boolean getStatsOn()

      Returns:
        True if statistics collection is turned on.

    - #### getStatsOnMs

          long getStatsOnMs()

      Returns:
        Timestamp stats were started at.

    - #### isLowResources

          boolean isLowResources()

      Check if low on resources. For most connectors, low resources is measured by calling `ThreadPool.isLowOnThreads()` on the connector threadpool or the server threadpool if there is no connector threadpool.

      For blocking connectors, low resources is used to trigger usage of `getLowResourceMaxIdleTime()` for the timeout of an idle connection.

      for non-blocking connectors, the number of connections is used instead of this method, to select the timeout of an idle connection.

      For all connectors, low resources is used to trigger the usage of `getLowResourceMaxIdleTime()` for read and write operations.

      Returns:
        true if this connector is low on resources.

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