public interface HttpServerResponse extends NettyOutbound, HttpInfos
FILE_CHUNKED_STRATEGY_BUFFER| Modifier and Type | Method and Description |
|---|---|
HttpServerResponse |
addCookie(Cookie cookie)
Add an outbound cookie
|
HttpServerResponse |
addHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Add an outbound http header, appending the value if the header already exist.
|
HttpServerResponse |
chunkedTransfer(boolean chunked)
Set transfer-encoding header
|
default HttpServerResponse |
context(java.util.function.Consumer<NettyContext> contextCallback)
Immediately call the passed callback with a
NettyContext to operate on the
underlying
Channel state. |
boolean |
hasSentHeaders()
Return true if headers and status have been sent to the client
|
HttpServerResponse |
header(java.lang.CharSequence name,
java.lang.CharSequence value)
Set an outbound header, replacing any pre-existing value.
|
HttpServerResponse |
headers(HttpHeaders headers)
Set outbound headers, replacing any pre-existing value for these headers.
|
HttpServerResponse |
keepAlive(boolean keepAlive)
Set the request keepAlive if true otherwise remove the existing connection keep alive header
|
default HttpServerResponse |
onWriteIdle(long idleTimeout,
java.lang.Runnable onWriteIdle)
Assign a
Runnable to be invoked when writes have become idle for the given
timeout. |
default HttpServerResponse |
options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
Provide a new
NettyOutbound scoped configuration for sending. |
HttpHeaders |
responseHeaders()
Return headers sent back to the clients
|
default Mono<java.lang.Void> |
send()
Send headers and empty content thus delimiting a full empty body http response.
|
NettyOutbound |
sendHeaders()
Return a
NettyOutbound successful on committed response |
Mono<java.lang.Void> |
sendNotFound()
Send 404 status
HttpResponseStatus.NOT_FOUND. |
Mono<java.lang.Void> |
sendRedirect(java.lang.String location)
Send redirect status
HttpResponseStatus.FOUND along with a location
header to the remote client. |
default Mono<java.lang.Void> |
sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> websocketHandler)
Upgrade connection to Websocket.
|
Mono<java.lang.Void> |
sendWebsocket(java.lang.String protocols,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> websocketHandler)
Upgrade connection to Websocket with optional subprotocol(s).
|
HttpServerResponse |
sse()
Add "text/event-stream" content-type for Server-Sent Events
|
HttpResponseStatus |
status()
Return the assigned HTTP status
|
HttpServerResponse |
status(HttpResponseStatus status)
Set an HTTP status to be sent along with the headers
|
default HttpServerResponse |
status(int status)
Set an HTTP status to be sent along with the headers
|
alloc, context, getFileChunkedStrategy, neverComplete, send, sendByteArray, sendFile, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendString, sendString, subscribe, then, thencookies, isKeepAlive, isWebsocket, method, path, uri, versionHttpServerResponse addCookie(Cookie cookie)
HttpServerResponse addHeader(java.lang.CharSequence name, java.lang.CharSequence value)
name - header namevalue - header valueHttpServerResponse chunkedTransfer(boolean chunked)
chunked - true if transfer-encoding:chunkeddefault HttpServerResponse context(java.util.function.Consumer<NettyContext> contextCallback)
NettyOutboundNettyContext to operate on the
underlying
Channel state. This allows for chaining outbound API.context in interface NettyOutboundcontextCallback - context callbackNettyContextboolean hasSentHeaders()
HttpServerResponse header(java.lang.CharSequence name, java.lang.CharSequence value)
name - headers keyvalue - header valueHttpServerResponse headers(HttpHeaders headers)
headers - netty headers mapHttpServerResponse keepAlive(boolean keepAlive)
default HttpServerResponse onWriteIdle(long idleTimeout, java.lang.Runnable onWriteIdle)
NettyOutboundRunnable to be invoked when writes have become idle for the given
timeout. This replaces any previously set idle callback.onWriteIdle in interface NettyOutboundidleTimeout - the idle timeoutonWriteIdle - the idle timeout handlerdefault HttpServerResponse options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
NettyOutboundNettyOutbound scoped configuration for sending. The
NettyPipeline.SendOptions changes will apply to the next written object or
Publisher.options in interface NettyOutboundconfigurator - the callback invoked to retrieve send configurationthis instanceHttpHeaders responseHeaders()
default Mono<java.lang.Void> send()
Mono successful on committed responseNettyOutbound.send(Publisher)NettyOutbound sendHeaders()
NettyOutbound successful on committed responseNettyOutbound successful on committed responseMono<java.lang.Void> sendNotFound()
HttpResponseStatus.NOT_FOUND.Mono successful on flush confirmationMono<java.lang.Void> sendRedirect(java.lang.String location)
HttpResponseStatus.FOUND along with a location
header to the remote client.location - the location to redirect toMono successful on flush confirmationdefault Mono<java.lang.Void> sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> websocketHandler)
Mono fails.websocketHandler - the in/out handler for ws transportMono completing when upgrade is confirmedMono<java.lang.Void> sendWebsocket(java.lang.String protocols, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> websocketHandler)
Mono fails.protocols - optional sub-protocolwebsocketHandler - the in/out handler for ws transportMono completing when upgrade is confirmedHttpServerResponse sse()
HttpResponseStatus status()
HttpServerResponse status(HttpResponseStatus status)
status - an HTTP status to be sent along with the headersdefault HttpServerResponse status(int status)
status - an HTTP status to be sent along with the headers