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:
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.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, 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.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(Throwable cause)Aborts all theHttpExchanges queued in this destination.StringasString()voidclose()voidclose(Connection connection)protected voidcreateConnection(org.eclipse.jetty.util.Promise<Connection> promise)protected voiddoStart()protected voiddoStop()voiddump(Appendable out, String indent)protected booleanenqueue(Queue<HttpExchange> queue, HttpExchange exchange)voidfailed(Throwable x)org.eclipse.jetty.io.ClientConnectionFactorygetClientConnectionFactory()Origin.AddressgetConnectAddress()ConnectionPoolgetConnectionPool()StringgetHost()org.eclipse.jetty.http.HttpFieldgetHostField()HttpClientgetHttpClient()Queue<HttpExchange>getHttpExchanges()OrigingetOrigin()intgetPort()ProxyConfiguration.ProxygetProxy()intgetQueuedRequestCount()RequestNotifiergetRequestNotifier()ResponseNotifiergetResponseNotifier()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 Queue<HttpExchange>newExchangeQueue(HttpClient client)protected org.eclipse.jetty.io.ClientConnectionFactorynewSslClientConnectionFactory(org.eclipse.jetty.io.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, List<Response.ResponseListener> listeners)voidsucceeded()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 Exception- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
newConnectionPool
protected ConnectionPool newConnectionPool(HttpClient client)
-
newExchangeQueue
protected Queue<HttpExchange> newExchangeQueue(HttpClient client)
-
newSslClientConnectionFactory
protected org.eclipse.jetty.io.ClientConnectionFactory newSslClientConnectionFactory(org.eclipse.jetty.io.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 org.eclipse.jetty.io.ClientConnectionFactory getClientConnectionFactory()
-
getScheme
@ManagedAttribute(value="The destination scheme", readonly=true) public 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 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 org.eclipse.jetty.http.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(Throwable x)
- Specified by:
failedin interfaceorg.eclipse.jetty.util.Callback
-
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()
-
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
release
public void release(Connection connection)
-
remove
public boolean remove(Connection connection)
-
close
public void close(Connection connection)
-
abort
public void abort(Throwable cause)
Aborts all theHttpExchanges queued in this destination.- Parameters:
cause- the abort cause
-
dump
public void dump(Appendable out, String indent) throws IOException
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Overrides:
dumpin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
IOException
-
asString
public String asString()
-
toString
public String toString()
- Overrides:
toStringin classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-