Class HttpDestination

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.client.HttpDestination
All Implemented Interfaces:
Closeable, AutoCloseable, Destination, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.Invocable, org.eclipse.jetty.util.thread.Sweeper.Sweepable
Direct Known Subclasses:
MultiplexHttpDestination, PoolingHttpDestination

@ManagedObject public abstract class HttpDestination extends org.eclipse.jetty.util.component.ContainerLifeCycle implements Destination, Closeable, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.thread.Sweeper.Sweepable
  • Constructor Details

  • Method Details

    • stale

      public boolean stale()
    • sweep

      public boolean sweep()
      Specified by:
      sweep in interface org.eclipse.jetty.util.thread.Sweeper.Sweepable
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      Exception
    • newConnectionPool

      protected ConnectionPool newConnectionPool(HttpClient client)
    • newExchangeQueue

      protected Queue<HttpExchange> newExchangeQueue(HttpClient client)
    • newSslClientConnectionFactory

      @Deprecated protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
      Creates a new SslClientConnectionFactory wrapping the given connection factory.
      Parameters:
      connectionFactory - the connection factory to wrap
      Returns:
      a new SslClientConnectionFactory
    • newSslClientConnectionFactory

      protected ClientConnectionFactory newSslClientConnectionFactory(org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory)
    • isSecure

      public boolean isSecure()
    • getHttpClient

      public HttpClient getHttpClient()
    • getOrigin

      public Origin getOrigin()
    • getHttpExchanges

      public Queue<HttpExchange> getHttpExchanges()
    • getRequestNotifier

      public RequestNotifier getRequestNotifier()
    • getResponseNotifier

      public ResponseNotifier getResponseNotifier()
    • getProxy

      public ProxyConfiguration.Proxy getProxy()
    • getClientConnectionFactory

      public ClientConnectionFactory getClientConnectionFactory()
    • getScheme

      @ManagedAttribute(value="The destination scheme", readonly=true) public String getScheme()
      Specified by:
      getScheme in interface Destination
      Returns:
      the scheme of this destination, such as "http" or "https"
    • getHost

      @ManagedAttribute(value="The destination host", readonly=true) public String getHost()
      Specified by:
      getHost in interface Destination
      Returns:
      the host of this destination, such as "127.0.0.1" or "google.com"
    • getPort

      @ManagedAttribute(value="The destination port", readonly=true) public int getPort()
      Specified by:
      getPort in interface Destination
      Returns:
      the port of this destination such as 80 or 443
    • getQueuedRequestCount

      @ManagedAttribute(value="The number of queued requests", readonly=true) public int getQueuedRequestCount()
    • getConnectAddress

      public Origin.Address getConnectAddress()
    • getHostField

      public HttpField getHostField()
    • getConnectionPool

      @ManagedAttribute(value="The connection pool", readonly=true) public ConnectionPool getConnectionPool()
    • succeeded

      public void succeeded()
      Specified by:
      succeeded in interface org.eclipse.jetty.util.Callback
    • failed

      public void failed(Throwable x)
      Specified by:
      failed in interface org.eclipse.jetty.util.Callback
    • send

      public void send(Request request, Response.CompleteListener listener)
    • send

      protected void send(HttpRequest request, List<Response.ResponseListener> listeners)
    • send

      public void send(HttpExchange exchange)
    • enqueue

      protected boolean enqueue(Queue<HttpExchange> queue, HttpExchange exchange)
    • send

      public void send()
    • send

      protected abstract SendFailure send(Connection connection, HttpExchange exchange)
    • newConnection

      public void newConnection(org.eclipse.jetty.util.Promise<Connection> promise)
      Description copied from interface: Destination
      Creates asynchronously a new, unpooled, Connection that will be returned at a later time through the given Promise.

      Use FuturePromise to wait for the connection:

       Destination destination = ...;
       FuturePromise<Connection> futureConnection = new FuturePromise<>();
       destination.newConnection(futureConnection);
       Connection connection = futureConnection.get(5, TimeUnit.SECONDS);
       
      Specified by:
      newConnection in interface Destination
      Parameters:
      promise - the promise of a new, unpooled, Connection
    • createConnection

      protected void createConnection(org.eclipse.jetty.util.Promise<Connection> promise)
    • remove

      public boolean remove(HttpExchange exchange)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • release

      public void release(Connection connection)
    • remove

      public boolean remove(Connection connection)
    • close

      @Deprecated public void close(Connection connection)
      Deprecated.
      use remove(Connection) instead
      Parameters:
      connection - the connection to remove
    • abort

      public void abort(Throwable cause)
      Aborts all the HttpExchanges queued in this destination.
      Parameters:
      cause - the abort cause
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Specified by:
      dump in interface org.eclipse.jetty.util.component.Dumpable
      Overrides:
      dump in class org.eclipse.jetty.util.component.ContainerLifeCycle
      Throws:
      IOException
    • asString

      public String asString()
    • getIdle

      @ManagedAttribute("For how long this destination has been idle in ms") public long getIdle()
    • isStale

      @ManagedAttribute("Whether this destinations is stale") public boolean isStale()
    • toString

      public String toString()
      Overrides:
      toString in class org.eclipse.jetty.util.component.AbstractLifeCycle