T
- a type representing the aggregated resultspublic static interface HttpResponse.MultiProcessor<T>
The server generated requests are also known as push promises. The server is permitted to send any number of these requests up to the point where the main response is fully received. Therefore, after completion of the main response body, the final number of additional responses is known. Additional responses may be cancelled, but given that the server does not wait for any acknowledgment before sending the response, this must be done quickly to avoid unnecessary data transmission.
MultiProcessor
s are parameterised with a type T
which
represents some meaningful aggregate of the responses received. This
would typically be a Collection of response or response body objects. One
example implementation can be found at HttpResponse.multiFile(java.nio.file.Path)
.
Modifier and Type | Method and Description |
---|---|
T |
onComplete()
Called after all responses associated with the multi response have
been fully processed, including response bodies.
|
BiFunction<HttpRequest,CompletableFuture<HttpResponse>,Boolean> |
onStart(HttpRequest mainRequest,
CompletableFuture<HttpResponse> response)
Called before or soon after a multi request is sent.
|
BiFunction<HttpRequest,CompletableFuture<HttpResponse>,Boolean> onStart(HttpRequest mainRequest, CompletableFuture<HttpResponse> response)
The parameters to the BiFunction
are the HttpRequest
for the push promise and a CompletableFuture
for its
response. The function must return a Boolean indicating whether the
push promise has been accepted (true) or should be canceled (false).
The CompletableFutures for any canceled pushes are themselves
completed exceptionally soon after the function returns.
mainRequest
- the main requestresponse
- a CompletableFuture for the main responseT onComplete()
Example types for T
could be Collections of response body
types or Map
s from request URI
to a response body
type.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-03-31-172659.buildd.src