Interface HttpResponse.BodyProcessor<T>
- Type Parameters:
T- the type of the response body
- Enclosing interface:
- HttpResponse
public static interface HttpResponse.BodyProcessor<T>
A processor for response bodies, which determines the type of the response body returned from HttpResponse.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonResponseBodyChunk(ByteBuffer byteBuffer) Called for each buffer of data received for this response.voidonResponseBodyStart(long contentLength, HttpHeaders responseHeaders, LongConsumer flowController) Called immediately before the response body is read.Called after the last timeonResponseBodyChunk(ByteBuffer)has been called and returned indicating that the entire content has been read.voidCalled if an error occurs while reading the response body.
-
Method Details
-
onResponseBodyStart
void onResponseBodyStart(long contentLength, HttpHeaders responseHeaders, LongConsumer flowController) throws IOException Called immediately before the response body is read.- Parameters:
contentLength- -1 signifies unknown content length. Otherwise, a positive integer, or zero.responseHeaders- the response headersflowController- a LongConsumer used to update the flow control window- Throws:
IOException- if an exception occurs starting the response body receive
-
onResponseBodyChunk
Called for each buffer of data received for this response.- Parameters:
byteBuffer- a ByteBuffer whose position is at the first byte that can be read, and whose limit is after the last byte that can be read- Throws:
IOException- in case of I/O error
-
onResponseComplete
Called after the last timeonResponseBodyChunk(ByteBuffer)has been called and returned indicating that the entire content has been read. This method must return an object that represents or contains the response body just received.- Returns:
- the T response body
- Throws:
IOException- in case of I/O error
-
onResponseError
Called if an error occurs while reading the response body. This terminates the operation and no further calls will occur after this.- Parameters:
t- the Throwable
-