Package org.eclipse.jetty.client
Class HttpExchange
- java.lang.Object
-
- org.eclipse.jetty.client.HttpExchange
-
- All Implemented Interfaces:
CyclicTimeouts.Expirable
public class HttpExchange extends java.lang.Object implements CyclicTimeouts.Expirable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HttpExchange.State
-
Field Summary
Fields Modifier and Type Field Description private HttpChannel
_channel
private HttpDestination
destination
private java.util.List<Response.ResponseListener>
listeners
private static Logger
LOG
private HttpRequest
request
private java.lang.Throwable
requestFailure
private HttpExchange.State
requestState
private HttpResponse
response
private java.lang.Throwable
responseFailure
private HttpExchange.State
responseState
-
Constructor Summary
Constructors Constructor Description HttpExchange(HttpDestination destination, HttpRequest request, java.util.List<Response.ResponseListener> listeners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
abort(java.lang.Throwable failure)
(package private) boolean
associate(HttpChannel channel)
Associates the givenchannel
to this exchange.private boolean
completeRequest(java.lang.Throwable failure)
private boolean
completeResponse(java.lang.Throwable failure)
(package private) void
disassociate(HttpChannel channel)
HttpConversation
getConversation()
long
getExpireNanoTime()
Returns the expiration time in nanoseconds.private HttpChannel
getHttpChannel()
HttpRequest
getRequest()
java.lang.Throwable
getRequestFailure()
HttpResponse
getResponse()
java.lang.Throwable
getResponseFailure()
java.util.List<Response.ResponseListener>
getResponseListeners()
private void
notifyFailureComplete(java.lang.Throwable failure)
void
proceed(java.lang.Throwable failure)
boolean
requestComplete(java.lang.Throwable failure)
void
resetResponse()
boolean
responseComplete(java.lang.Throwable failure)
Result
terminateRequest()
Result
terminateResponse()
java.lang.String
toString()
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
destination
private final HttpDestination destination
-
request
private final HttpRequest request
-
listeners
private final java.util.List<Response.ResponseListener> listeners
-
response
private final HttpResponse response
-
requestState
private HttpExchange.State requestState
-
responseState
private HttpExchange.State responseState
-
_channel
private HttpChannel _channel
-
requestFailure
private java.lang.Throwable requestFailure
-
responseFailure
private java.lang.Throwable responseFailure
-
-
Constructor Detail
-
HttpExchange
public HttpExchange(HttpDestination destination, HttpRequest request, java.util.List<Response.ResponseListener> listeners)
-
-
Method Detail
-
getConversation
public HttpConversation getConversation()
-
getRequest
public HttpRequest getRequest()
-
getRequestFailure
public java.lang.Throwable getRequestFailure()
-
getResponseListeners
public java.util.List<Response.ResponseListener> getResponseListeners()
-
getResponse
public HttpResponse getResponse()
-
getResponseFailure
public java.lang.Throwable getResponseFailure()
-
getExpireNanoTime
public long getExpireNanoTime()
Description copied from interface:CyclicTimeouts.Expirable
Returns the expiration time in nanoseconds.
The value to return must be calculated taking into account
System.nanoTime()
, for example:expireNanoTime = System.nanoTime() + timeoutNanos
Returning
Long.MAX_VALUE
indicates that this entity does not expire.- Specified by:
getExpireNanoTime
in interfaceCyclicTimeouts.Expirable
- Returns:
- the expiration time in nanoseconds, or
Long.MAX_VALUE
if this entity does not expire
-
associate
boolean associate(HttpChannel channel)
Associates the given
channel
to this exchange.Works in strict collaboration with
HttpChannel.associate(HttpExchange)
.- Parameters:
channel
- the channel to associate to this exchange- Returns:
- true if the channel could be associated, false otherwise
-
disassociate
void disassociate(HttpChannel channel)
-
getHttpChannel
private HttpChannel getHttpChannel()
-
requestComplete
public boolean requestComplete(java.lang.Throwable failure)
-
completeRequest
private boolean completeRequest(java.lang.Throwable failure)
-
responseComplete
public boolean responseComplete(java.lang.Throwable failure)
-
completeResponse
private boolean completeResponse(java.lang.Throwable failure)
-
terminateRequest
public Result terminateRequest()
-
terminateResponse
public Result terminateResponse()
-
abort
public boolean abort(java.lang.Throwable failure)
-
notifyFailureComplete
private void notifyFailureComplete(java.lang.Throwable failure)
-
resetResponse
public void resetResponse()
-
proceed
public void proceed(java.lang.Throwable failure)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-