public abstract class HttpDestination extends Object implements Destination, Closeable, Dumpable
Destination.Address
Constructor and Description |
---|
HttpDestination(HttpClient client,
String scheme,
String host,
int port) |
Modifier and Type | Method and Description |
---|---|
protected void |
abort(HttpExchange exchange,
Throwable cause)
Aborts the given
exchange , notifies listeners of the failure, and completes the exchange. |
void |
abort(Throwable cause)
Aborts all the
HttpExchange s queued in this destination. |
String |
asString() |
void |
close() |
protected void |
createConnection(Promise<Connection> promise) |
String |
dump() |
void |
dump(Appendable out,
String indent) |
Destination.Address |
getConnectAddress() |
String |
getHost() |
HttpField |
getHostField() |
HttpClient |
getHttpClient() |
Queue<HttpExchange> |
getHttpExchanges() |
int |
getPort() |
URI |
getProxyURI() |
RequestNotifier |
getRequestNotifier() |
ResponseNotifier |
getResponseNotifier() |
String |
getScheme() |
boolean |
isProxied() |
void |
newConnection(Promise<Connection> promise)
Creates asynchronously a new, unpooled,
Connection that will be returned
at a later time through the given Promise . |
boolean |
remove(HttpExchange exchange) |
protected abstract void |
send() |
protected void |
send(Request request,
List<Response.ResponseListener> listeners) |
String |
toString() |
protected void |
tunnelFailed(Connection connection,
Promise<Connection> promise,
Throwable failure) |
protected void |
tunnelSucceeded(Connection connection,
Promise<Connection> promise) |
protected static final Logger LOG
public HttpDestination(HttpClient client, String scheme, String host, int port)
public HttpClient getHttpClient()
public Queue<HttpExchange> getHttpExchanges()
public RequestNotifier getRequestNotifier()
public ResponseNotifier getResponseNotifier()
public String getScheme()
getScheme
in interface Destination
public String getHost()
getHost
in interface Destination
public int getPort()
getPort
in interface Destination
public Destination.Address getConnectAddress()
public boolean isProxied()
public URI getProxyURI()
public HttpField getHostField()
protected void send(Request request, List<Response.ResponseListener> listeners)
protected abstract void send()
public void newConnection(Promise<Connection> promise)
Destination
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);
newConnection
in interface Destination
promise
- the promise of a new, unpooled, Connection
protected void createConnection(Promise<Connection> promise)
public boolean remove(HttpExchange exchange)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void abort(Throwable cause)
HttpExchange
s queued in this destination.cause
- the abort causeabort(HttpExchange, Throwable)
protected void abort(HttpExchange exchange, Throwable cause)
exchange
, notifies listeners of the failure, and completes the exchange.exchange
- the HttpExchange
to abortcause
- the abort causeprotected void tunnelSucceeded(Connection connection, Promise<Connection> promise)
protected void tunnelFailed(Connection connection, Promise<Connection> promise, Throwable failure)
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
IOException
public String asString()
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.