- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
Http1ClientResponse,Http2ClientResponse,JsonRpcClientBatchResponse,JsonRpcClientResponse
Http client response.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TRead the entity as a specific type.voidclose()Closes the response.entity()Response entity.headers()Response headers.default InputStreamEntity input stream.URI of the last request.default <T extends Source<?>>
voidsource(GenericType<T> sourceType, T source) Registers a source listener for this response.status()Response status.trailers()Response trailer headers.
-
Method Details
-
entity
ReadableEntity entity()Response entity.- Returns:
- entity
-
inputStream
Entity input stream. This is a shortcut toentity()andReadableEntity.inputStream().- Returns:
- input stream
-
as
Read the entity as a specific type. This is a shortcut toentity()andReadableEntity.as(Class).- Type Parameters:
T- type of the entity- Parameters:
type- class of the entity- Returns:
- typed entity
-
source
Registers a source listener for this response.- Type Parameters:
T- the actual source type- Parameters:
sourceType- the generic source typesource- the source- Throws:
UnsupportedOperationException- if operation not implemented on this response or not provider for this listener is found
-
close
void close()Closes the response. This may have no impact on the underlying connection. Response is implicitly closed if the entity is fully read (either throughentity()or throughinputStream().- Specified by:
closein interfaceAutoCloseable
-
status
Status status()Response status.- Returns:
- status
-
headers
ClientResponseHeaders headers()Response headers.- Returns:
- headers
-
trailers
ClientResponseTrailers trailers()Response trailer headers. Blocks until trailers are available.- Returns:
- trailers
- Throws:
IllegalStateException- when invoked before entity is requested
-
lastEndpointUri
ClientUri lastEndpointUri()URI of the last request. (after redirection)- Returns:
- last URI
-