Package org.eclipse.jetty.client
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:
java.io.Closeable,java.lang.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.LifeCycle,org.eclipse.jetty.util.thread.Invocable
- Direct Known Subclasses:
MultiplexHttpDestination,PoolingHttpDestination
@ManagedObject public abstract class HttpDestination extends org.eclipse.jetty.util.component.ContainerLifeCycle implements Destination, java.io.Closeable, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.component.Dumpable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
org.eclipse.jetty.util.Callback.Completable, org.eclipse.jetty.util.Callback.Completing, org.eclipse.jetty.util.Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.eclipse.jetty.util.log.LoggerLOG
-
Constructor Summary
Constructors Constructor Description HttpDestination(HttpClient client, Origin origin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidabort(java.lang.Throwable cause)Aborts all theHttpExchanges queued in this destination.java.lang.StringasString()voidclose()voidclose(Connection connection)protected voidcreateConnection(org.eclipse.jetty.util.Promise<Connection> promise)protected voiddoStart()protected voiddoStop()voiddump(java.lang.Appendable out, java.lang.String indent)protected booleanenqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)voidfailed(java.lang.Throwable x)ClientConnectionFactorygetClientConnectionFactory()Origin.AddressgetConnectAddress()ConnectionPoolgetConnectionPool()java.lang.StringgetHost()HttpFieldgetHostField()HttpClientgetHttpClient()java.util.Queue<HttpExchange>getHttpExchanges()OrigingetOrigin()intgetPort()ProxyConfiguration.ProxygetProxy()intgetQueuedRequestCount()RequestNotifiergetRequestNotifier()ResponseNotifiergetResponseNotifier()java.lang.StringgetScheme()booleanisSecure()voidnewConnection(org.eclipse.jetty.util.Promise<Connection> promise)Creates asynchronously a new, unpooled,Connectionthat will be returned at a later time through the givenPromise.protected ConnectionPoolnewConnectionPool(HttpClient client)protected java.util.Queue<HttpExchange>newExchangeQueue(HttpClient client)protected ClientConnectionFactorynewSslClientConnectionFactory(ClientConnectionFactory connectionFactory)booleanprocess(Connection connection)voidrelease(Connection connection)booleanremove(Connection connection)booleanremove(HttpExchange exchange)voidsend()protected abstract SendFailuresend(Connection connection, HttpExchange exchange)voidsend(HttpExchange exchange)protected voidsend(HttpRequest request, java.util.List<Response.ResponseListener> listeners)voidsucceeded()java.lang.StringtoString()-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Constructor Detail
-
HttpDestination
public HttpDestination(HttpClient client, Origin origin)
-
-
Method Detail
-
doStart
protected void doStart() throws java.lang.Exception- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
java.lang.Exception
-
newConnectionPool
protected ConnectionPool newConnectionPool(HttpClient client)
-
newExchangeQueue
protected java.util.Queue<HttpExchange> newExchangeQueue(HttpClient client)
-
newSslClientConnectionFactory
protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
-
isSecure
public boolean isSecure()
-
getHttpClient
public HttpClient getHttpClient()
-
getOrigin
public Origin getOrigin()
-
getHttpExchanges
public java.util.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 java.lang.String getScheme()- Specified by:
getSchemein interfaceDestination- Returns:
- the scheme of this destination, such as "http" or "https"
-
getHost
@ManagedAttribute(value="The destination host", readonly=true) public java.lang.String getHost()- Specified by:
getHostin interfaceDestination- 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:
getPortin interfaceDestination- 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:
succeededin interfaceorg.eclipse.jetty.util.Callback
-
failed
public void failed(java.lang.Throwable x)
- Specified by:
failedin interfaceorg.eclipse.jetty.util.Callback
-
send
protected void send(HttpRequest request, java.util.List<Response.ResponseListener> listeners)
-
send
public void send(HttpExchange exchange)
-
enqueue
protected boolean enqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)
-
send
public void send()
-
process
public boolean process(Connection connection)
-
send
protected abstract SendFailure send(Connection connection, HttpExchange exchange)
-
newConnection
public void newConnection(org.eclipse.jetty.util.Promise<Connection> promise)
Description copied from interface:DestinationCreates asynchronously a new, unpooled,Connectionthat will be returned at a later time through the givenPromise.Use
FuturePromiseto wait for the connection:Destination destination = ...; FuturePromise<Connection> futureConnection = new FuturePromise<>(); destination.newConnection(futureConnection); Connection connection = futureConnection.get(5, TimeUnit.SECONDS);
- Specified by:
newConnectionin interfaceDestination- 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
release
public void release(Connection connection)
-
remove
public boolean remove(Connection connection)
-
close
public void close(Connection connection)
-
abort
public void abort(java.lang.Throwable cause)
Aborts all theHttpExchanges queued in this destination.- Parameters:
cause- the abort cause
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Overrides:
dumpin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
java.io.IOException
-
asString
public java.lang.String asString()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-