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,Callback,Container,Destroyable,Dumpable,Dumpable.DumpableContainer,LifeCycle,Invocable,Sweeper.Sweepable
- Direct Known Subclasses:
DuplexHttpDestination,MultiplexHttpDestination
@ManagedObject
public abstract class HttpDestination
extends ContainerLifeCycle
implements Destination, Closeable, Callback, Dumpable, Sweeper.Sweepable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.NestedNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking -
Constructor Summary
ConstructorsConstructorDescriptionHttpDestination(HttpClient client, Origin origin, boolean intrinsicallySecure) -
Method Summary
Modifier and TypeMethodDescriptionvoidAborts all theHttpExchanges queued in this destination.voidaccept(Connection connection) asString()voidclose()protected voidcreateConnection(Promise<Connection> promise) protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected booleanenqueue(Queue<HttpExchange> queue, HttpExchange exchange) voidCallback invoked when the operation fails.getHost()longgetIdle()intgetPort()getProxy()intbooleanisSecure()booleanisStale()voidnewConnection(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 ClientConnectionFactorynewSslClientConnectionFactory(SslContextFactory.Client sslContextFactory, ClientConnectionFactory connectionFactory) voidrelease(Connection connection) booleanremove(Connection connection) booleanremove(HttpExchange exchange) voidsend()voidsend(Request request, Response.CompleteListener listener) voidsend(HttpExchange exchange) protected voidsend(HttpRequest request, List<Response.ResponseListener> listeners) protected SendFailuresend(IConnection connection, HttpExchange exchange) booleanstale()voidCallback invoked when the operation completes.booleansweep()toString()Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Callback
completeWithMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
Constructor Details
-
HttpDestination
-
-
Method Details
-
accept
-
stale
public boolean stale() -
sweep
public boolean sweep()- Specified by:
sweepin interfaceSweeper.Sweepable- Returns:
- whether this resource should be swept
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContainerLifeCycle- Throws:
AbstractLifeCycle.StopException- If thrown, the lifecycle will immediately be stopped.Exception- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classContainerLifeCycle- Throws:
Exception- If there was a problem stopping. Will cause a transition to FAILED state
-
newConnectionPool
-
newExchangeQueue
-
newSslClientConnectionFactory
protected ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.Client sslContextFactory, ClientConnectionFactory connectionFactory) -
isSecure
public boolean isSecure() -
getHttpClient
-
getOrigin
-
getHttpExchanges
-
getRequestNotifier
-
getResponseNotifier
-
getProxy
-
getClientConnectionFactory
-
getScheme
- Specified by:
getSchemein interfaceDestination- Returns:
- the scheme of this destination, such as "http" or "https"
-
getHost
- Specified by:
getHostin interfaceDestination- Returns:
- the host of this destination, such as "127.0.0.1" or "google.com"
-
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
-
getHostField
-
getConnectionPool
@ManagedAttribute(value="The connection pool", readonly=true) public ConnectionPool getConnectionPool() -
succeeded
public void succeeded()Description copied from interface:CallbackCallback invoked when the operation completes.
-
failed
Description copied from interface:CallbackCallback invoked when the operation fails.
-
send
-
send
-
send
-
enqueue
-
send
public void send() -
send
-
newConnection
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
-
remove
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
release
-
remove
-
abort
Aborts all theHttpExchanges queued in this destination.- Parameters:
cause- the abort cause
-
dump
Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dumpin interfaceDumpable- Overrides:
dumpin classContainerLifeCycle- Parameters:
out- The appendable to dump toindent- The indent to apply after any new lines.- Throws:
IOException- if unable to write to Appendable
-
asString
-
getIdle
-
isStale
-
toString
- Overrides:
toStringin classAbstractLifeCycle
-