Response represents an HTTP response and offers methods to retrieve status code, HTTP version
and headers.
Response objects are passed as parameters to Response. callbacks, or as
future result of Request#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 via content
events, or via utility classes such as BufferingResponseListener.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Response.
Asynchronous listener for the response content events. |
| public static interface | Response.
Listener for the response begin event. |
| public static interface | Response.
Listener for the request and response completed event. |
| public static interface | Response.
Synchronous listener for the response content events. |
| public static interface | Response.
Asynchronous listener for the response content events. |
| public static interface | Response.
Listener for the response failure event. |
| public static interface | Response.
Listener for a response header event. |
| public static interface | Response.
Listener for the response headers event. |
| public static interface | Response.
Listener for all response events. |
| public static interface | Response.
Common, empty, super-interface for response listeners |
| public static interface | Response.
Listener for the response succeeded event. |
| Modifier and Type | Method and Description |
|---|---|
| public CompletableFuture | |
| public HttpFields | |
| public String | |
| public Request | |
| public int | |
| public HttpFields | |
| public HttpVersion |
| abort | back to summary |
|---|---|
| public CompletableFuture Attempts to abort the receive of this response.
| |
| getHeaders | back to summary |
|---|---|
| public HttpFields getHeaders() Returns the headers of this response. Some headers sent by the server may not be present,
or be present but modified, while the content is being
processed.
A typical example is the Similarly, the
| |
| getReason | back to summary |
|---|---|
| public String getReason() | |
| getRequest | back to summary |
|---|---|
public Request getRequest()
| |
| getStatus | back to summary |
|---|---|
public int getStatus()
| |
| getTrailers | back to summary |
|---|---|
public HttpFields getTrailers()
| |
| getVersion | back to summary |
|---|---|
public HttpVersion getVersion()
| |
ContentSourceListener
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public default void | onContentSource(Response
the response containing the response line data and the headers response, Content.the contentSourceContent. that must be driven to read the dataImplements org. Callback method invoked when all the response headers have been received and parsed. |
| onContent | back to summary |
|---|---|
| public void onContent(Response response, Content. | |
| onContentSource | back to summary |
|---|---|
| public default void onContentSource(Response response, Content. Implements org. Doc from org. Callback method invoked when all the response headers have been received and parsed.
It is responsible for driving the
| |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| onBegin | back to summary |
|---|---|
| public void onBegin(Response response) Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed. This method is the best approximation to detect when the first bytes of the response arrived to the client.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | onComplete(Result
the result of the request / response exchange result)Callback method invoked when the request and the response have been processed, either successfully or not. |
| onComplete | back to summary |
|---|---|
| public void onComplete(Result result) Callback method invoked when the request and the response have been processed, either successfully or not.
The
Requests may complete after response, for example in case of big uploads that are
discarded or read asynchronously by the server.
This method is always invoked after
| |
AsyncContentListener
| Modifier and Type | Method and Description |
|---|---|
| public void | onContent(Response
the response containing the response line data and the headers response, ByteBuffer the content bytes received content)Callback method invoked when the response content has been received, parsed and there is demand. |
| public default void |
| onContent | back to summary |
|---|---|
| public void onContent(Response response, ByteBuffer content) Callback method invoked when the response content has been received, parsed and there is demand.
This method may be invoked multiple times, and the
| |
| onContent | back to summary |
|---|---|
| public default void onContent(Response response, Content. Implements org.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | onContentSource(Response
the response containing the response line data and the headers response, Content.the contentSourceContent. that must be driven to read the dataCallback method invoked when all the response headers have been received and parsed. |
| onContentSource | back to summary |
|---|---|
| public void onContentSource(Response response, Content. Callback method invoked when all the response headers have been received and parsed.
It is responsible for driving the
| |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| onFailure | back to summary |
|---|---|
| public void onFailure(Response response, Throwable failure) Callback method invoked when the response has failed in the process of being received | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true to process the header, false to skip processing of the headerthe response containing the response line data and the headers so far response, HttpField the header received field)Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not. |
| onHeader | back to summary |
|---|---|
| public boolean onHeader(Response response, HttpField field) Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not. | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| onHeaders | back to summary |
|---|---|
| public void onHeaders(Response response) Callback method invoked when all the response headers have been received and parsed.
| |
| Modifier and Type | Method and Description |
|---|---|
| public default void | onBegin(Response
the response containing the response line data response)Implements org. Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed. |
| public default void | onComplete(Result
the result of the request / response exchange result)Implements org. Callback method invoked when the request and the response have been processed, either successfully or not. |
| public default void | onContent(Response
the response containing the response line data and the headers response, ByteBuffer the content bytes received content)Implements org. Callback method invoked when the response content has been received, parsed and there is demand. |
| public default void | onFailure(Response
the response containing data up to the point the failure happened response, Throwable the failure happened failure)Implements org. Callback method invoked when the response has failed in the process of being received |
| public default boolean | onHeader(Response
the response containing the response line data and the headers so far response, HttpField the header received field)Implements org. Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not. |
| public default void | onHeaders(Response
the response containing the response line data and the headers response)Implements org. Callback method invoked when all the response headers have been received and parsed. |
| public default void | onSuccess(Response
the response containing the response line data and the headers response)Implements org. Callback method invoked when the whole response has been successfully received. |
| onBegin | back to summary |
|---|---|
| public default void onBegin(Response response) Implements org. Doc from org. Callback method invoked when the response line containing HTTP version, HTTP status code and reason has been received and parsed. This method is the best approximation to detect when the first bytes of the response arrived to the client. | |
| onComplete | back to summary |
|---|---|
| public default void onComplete(Result result) Implements org. Doc from org. Callback method invoked when the request and the response have been processed, either successfully or not.
The
Requests may complete after response, for example in case of big uploads that are
discarded or read asynchronously by the server.
This method is always invoked after | |
| onContent | back to summary |
|---|---|
| public default void onContent(Response response, ByteBuffer content) Implements org. Doc from org. Callback method invoked when the response content has been received, parsed and there is demand.
This method may be invoked multiple times, and the
| |
| onFailure | back to summary |
|---|---|
| public default void onFailure(Response response, Throwable failure) Implements org. Doc from org. Callback method invoked when the response has failed in the process of being received | |
| onHeader | back to summary |
|---|---|
| public default boolean onHeader(Response response, HttpField field) Implements org. Doc from org. Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not. | |
| onHeaders | back to summary |
|---|---|
| public default void onHeaders(Response response) Implements org. Doc from org. Callback method invoked when all the response headers have been received and parsed. | |
| onSuccess | back to summary |
|---|---|
| public default void onSuccess(Response response) Implements org. Doc from org. Callback method invoked when the whole response has been successfully received. | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| onSuccess | back to summary |
|---|---|
| public void onSuccess(Response response) Callback method invoked when the whole response has been successfully received.
| |