Package io.helidon.reactive.webserver
Interface ResponseHeaders
- All Superinterfaces:
ClientResponseHeaders,Headers,Iterable<Http.HeaderValue>,ServerResponseHeaders,WritableHeaders<ServerResponseHeaders>
Extends
ServerResponseHeaders interface by adding HTTP response headers oriented constants and
convenient methods.
Use constants located in Http.Header as standard header names.
Lifecycle
Headers can be muted untilsend to the client. It is also possible to register a 'before send' function which can made 'last minute mutation'.
Headers are send together with HTTP status code also automatically just before first chunk of response data is send.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeSend(Consumer<ResponseHeaders> headersConsumer) Register aConsumerwhich is executed just before headers are send.send()Send headers and status code to the client.whenSent()Returns aSinglewhich is completed when all headers are sent to the client.Methods inherited from interface io.helidon.common.http.ClientResponseHeaders
acceptPatches, expires, lastModified, locationMethods inherited from interface io.helidon.common.http.Headers
acceptedTypes, all, all, contains, contains, contentLength, contentType, first, get, isAccepted, size, toMap, value, valuesMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface io.helidon.common.http.ServerResponseHeaders
addAcceptPatches, addAcceptPatches, addCookie, addCookie, addCookie, clearCookie, expires, expires, lastModified, lastModified, locationMethods inherited from interface io.helidon.common.http.WritableHeaders
add, add, clear, contentLength, contentType, contentType, remove, remove, set, set, set, setIfAbsent
-
Method Details
-
beforeSend
Register aConsumerwhich is executed just before headers are send.Consumercan made 'last minute changes' in headers.Sending of headers to the client is postponed after all registered consumers are finished.
There is no guarantied execution order.
- Parameters:
headersConsumer- a consumer which will be executed just before headers are send.
-
whenSent
Single<ResponseHeaders> whenSent()Returns aSinglewhich is completed when all headers are sent to the client.- Returns:
- a single of the headers
-
send
Single<ResponseHeaders> send()Send headers and status code to the client. This instance become immutable after that (all muting methods throwsIllegalStateException).It is non-blocking method returning a
Single.- Returns:
- a completion stage of sending process.
-