Package org.eclipse.jetty.client.api
Interface Response
-
- All Known Subinterfaces:
ContentResponse
- All Known Implementing Classes:
HttpContentResponse
,HttpResponse
public interface Response
Response
represents an HTTP response and offers methods to retrieve status code, HTTP version and headers.Response
objects are passed as parameters toResponse.Listener
callbacks, or as future result ofRequest.send()
.Response
objects do not contain getters for the response content, because it may be too large to fit into memory. The response content should be retrieved viacontent events
, or via utility classes such asBufferingResponseListener
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Response.AsyncContentListener
Asynchronous listener for the response content events.static interface
Response.BeginListener
Listener for the response begin event.static interface
Response.CompleteListener
Listener for the request and response completed event.static interface
Response.ContentListener
Synchronous listener for the response content events.static interface
Response.DemandedContentListener
Asynchronous listener for the response content events.static interface
Response.FailureListener
Listener for the response failure event.static interface
Response.HeaderListener
Listener for a response header event.static interface
Response.HeadersListener
Listener for the response headers event.static interface
Response.Listener
Listener for all response events.static interface
Response.ResponseListener
Common, empty, super-interface for response listenersstatic interface
Response.SuccessListener
Listener for the response succeeded event.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
abort(java.lang.Throwable cause)
Attempts to abort the receive of this response.HttpFields
getHeaders()
<T extends Response.ResponseListener>
java.util.List<T>getListeners(java.lang.Class<T> listenerClass)
java.lang.String
getReason()
Request
getRequest()
int
getStatus()
HttpVersion
getVersion()
-
-
-
Method Detail
-
getRequest
Request getRequest()
- Returns:
- the request associated with this response
-
getListeners
<T extends Response.ResponseListener> java.util.List<T> getListeners(java.lang.Class<T> listenerClass)
- Type Parameters:
T
- the type of class- Parameters:
listenerClass
- the listener class- Returns:
- the response listener passed to
Request.send(org.eclipse.jetty.client.api.Response.CompleteListener)
-
getVersion
HttpVersion getVersion()
- Returns:
- the HTTP version of this response, such as "HTTP/1.1"
-
getStatus
int getStatus()
- Returns:
- the HTTP status code of this response, such as 200 or 404
-
getReason
java.lang.String getReason()
- Returns:
- the HTTP reason associated to the
getStatus()
-
getHeaders
HttpFields getHeaders()
- Returns:
- the headers of this response
-
abort
boolean abort(java.lang.Throwable cause)
Attempts to abort the receive of this response.- Parameters:
cause
- the abort cause, must not be null- Returns:
- whether the abort succeeded
-
-