Package org.eclipse.jetty.client.api
Interface Response
-
- All Known Subinterfaces:
ContentResponse
- All Known Implementing Classes:
HttpContentResponse,HttpResponse
public interface ResponseResponserepresents an HTTP response and offers methods to retrieve status code, HTTP version and headers.Responseobjects are passed as parameters toResponse.Listenercallbacks, or as future result ofRequest.send().Responseobjects 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 interfaceResponse.AsyncContentListenerAsynchronous listener for the response content events.static interfaceResponse.BeginListenerListener for the response begin event.static interfaceResponse.CompleteListenerListener for the request and response completed event.static interfaceResponse.ContentListenerSynchronous listener for the response content events.static interfaceResponse.DemandedContentListenerAsynchronous listener for the response content events.static interfaceResponse.FailureListenerListener for the response failure event.static interfaceResponse.HeaderListenerListener for a response header event.static interfaceResponse.HeadersListenerListener for the response headers event.static interfaceResponse.ListenerListener for all response events.static interfaceResponse.ResponseListenerCommon, empty, super-interface for response listenersstatic interfaceResponse.SuccessListenerListener for the response succeeded event.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanabort(java.lang.Throwable cause)Attempts to abort the receive of this response.HttpFieldsgetHeaders()<T extends Response.ResponseListener>
java.util.List<T>getListeners(java.lang.Class<T> listenerClass)java.lang.StringgetReason()RequestgetRequest()intgetStatus()HttpVersiongetVersion()
-
-
-
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
-
-