public interface HttpServerResponse extends NettyOutbound, HttpInfos
| Modifier and Type | Method and Description |
|---|---|
HttpServerResponse |
addCookie(io.netty.handler.codec.http.cookie.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
|
HttpServerResponse |
compression(boolean compress)
Enable/Disable compression handling (gzip/deflate) for the underlying response
|
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(io.netty.handler.codec.http.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 |
options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
Provide a new
NettyOutbound scoped configuration for sending. |
io.netty.handler.codec.http.HttpHeaders |
responseHeaders()
Return headers sent back to the clients
|
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.
|
default 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).
|
Mono<java.lang.Void> |
sendWebsocket(java.lang.String protocols,
int maxFramePayloadLength,
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
|
io.netty.handler.codec.http.HttpResponseStatus |
status()
Return the assigned HTTP status
|
HttpServerResponse |
status(io.netty.handler.codec.http.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
|
HttpServerResponse |
withConnection(java.util.function.Consumer<? super Connection> withConnection)
Call the passed callback with a
Connection to operate on the underlying
Channel state. |
alloc, neverComplete, send, sendByteArray, sendFile, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendString, sendString, sendUsing, subscribe, then, thencookies, isKeepAlive, isWebsocket, method, path, uri, versionHttpServerResponse addCookie(io.netty.handler.codec.http.cookie.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:chunkedHttpServerResponse withConnection(java.util.function.Consumer<? super Connection> withConnection)
NettyOutboundConnection to operate on the underlying
Channel state.withConnection in interface NettyOutboundwithConnection - connection callbackConnectionHttpServerResponse compression(boolean compress)
compress - should handle compressionboolean hasSentHeaders()
HttpServerResponse header(java.lang.CharSequence name, java.lang.CharSequence value)
name - headers keyvalue - header valueHttpServerResponse headers(io.netty.handler.codec.http.HttpHeaders headers)
headers - netty headers mapHttpServerResponse keepAlive(boolean keepAlive)
default 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 instanceio.netty.handler.codec.http.HttpHeaders responseHeaders()
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 confirmeddefault Mono<java.lang.Void> sendWebsocket(@Nullable 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 confirmedMono<java.lang.Void> sendWebsocket(@Nullable java.lang.String protocols, int maxFramePayloadLength, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> websocketHandler)
Mono fails.protocols - optional sub-protocolmaxFramePayloadLength - maximum allowable frame payload lengthwebsocketHandler - the in/out handler for ws transportMono completing when upgrade is confirmedHttpServerResponse sse()
io.netty.handler.codec.http.HttpResponseStatus status()
HttpServerResponse status(io.netty.handler.codec.http.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