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.InvocableCallback, 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.Logger
LOG
-
Constructor Summary
Constructors Constructor Description HttpDestination(HttpClient client, Origin origin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
abort(java.lang.Throwable cause)
Aborts all theHttpExchange
s queued in this destination.java.lang.String
asString()
void
close()
void
close(Connection connection)
protected void
createConnection(org.eclipse.jetty.util.Promise<Connection> promise)
protected void
doStart()
protected void
doStop()
void
dump(java.lang.Appendable out, java.lang.String indent)
protected boolean
enqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)
void
failed(java.lang.Throwable x)
ClientConnectionFactory
getClientConnectionFactory()
Origin.Address
getConnectAddress()
ConnectionPool
getConnectionPool()
java.lang.String
getHost()
HttpField
getHostField()
HttpClient
getHttpClient()
java.util.Queue<HttpExchange>
getHttpExchanges()
Origin
getOrigin()
int
getPort()
ProxyConfiguration.Proxy
getProxy()
int
getQueuedRequestCount()
RequestNotifier
getRequestNotifier()
ResponseNotifier
getResponseNotifier()
java.lang.String
getScheme()
boolean
isSecure()
void
newConnection(org.eclipse.jetty.util.Promise<Connection> promise)
Creates asynchronously a new, unpooled,Connection
that will be returned at a later time through the givenPromise
.protected ConnectionPool
newConnectionPool(HttpClient client)
protected java.util.Queue<HttpExchange>
newExchangeQueue(HttpClient client)
protected ClientConnectionFactory
newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
Deprecated.protected ClientConnectionFactory
newSslClientConnectionFactory(org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory)
boolean
process(Connection connection)
void
release(Connection connection)
boolean
remove(Connection connection)
boolean
remove(HttpExchange exchange)
void
send()
protected abstract SendFailure
send(Connection connection, HttpExchange exchange)
void
send(HttpExchange exchange)
protected void
send(HttpRequest request, java.util.List<Response.ResponseListener> listeners)
void
succeeded()
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
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:
doStart
in classorg.eclipse.jetty.util.component.ContainerLifeCycle
- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception
- Overrides:
doStop
in 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
@Deprecated protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
Deprecated.Creates a newSslClientConnectionFactory
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 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:
getScheme
in 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:
getHost
in 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:
getPort
in 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:
succeeded
in interfaceorg.eclipse.jetty.util.Callback
-
failed
public void failed(java.lang.Throwable x)
- Specified by:
failed
in 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:Destination
Creates asynchronously a new, unpooled,Connection
that will be returned at a later time through the givenPromise
.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 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in 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 theHttpExchange
s 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:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
- Overrides:
dump
in classorg.eclipse.jetty.util.component.ContainerLifeCycle
- Throws:
java.io.IOException
-
asString
public java.lang.String asString()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-