Interface Response
- All Known Subinterfaces:
ContentResponse
- All Known Implementing Classes:
HttpResponse
Response represents an HTTP response and offers methods to retrieve status code, HTTP version
and headers.
Response objects are passed as parameters to Response.Listener 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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAsynchronous listener for the response content events.static interfaceListener for the response begin event.static interfaceListener for the request and response completed event.static interfaceSynchronous listener for the response content events.static interfaceAsynchronous listener for the response content events.static interfaceListener for the response failure event.static interfaceListener for a response header event.static interfaceListener for the response headers event.static interfaceListener for all response events.static interfaceCommon, empty, super-interface for response listenersstatic interfaceListener for the response succeeded event. -
Method Summary
Modifier and TypeMethodDescriptionAttempts to abort the receive of this response.Returns the headers of this response.int
-
Method Details
-
getRequest
Request getRequest()- Returns:
- the request associated with this response
-
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
String getReason()- Returns:
- the HTTP reason associated to the
getStatus()
-
getHeaders
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
Content-Lengthheader when the content is sent compressed by the server and automatically decompressed by the client: theContent-Lengthheader will be removed.Similarly, the
Content-Encodingheader may be removed or modified, as the content is decoded by the client.- Returns:
- the headers of this response
-
getTrailers
HttpFields getTrailers()- Returns:
- the trailers of this response
-
abort
Attempts to abort the receive of this response.- Parameters:
cause- the abort cause, must not be null- Returns:
- whether the abort succeeded
-