public interface HttpServerResponse extends NettyOutbound, HttpInfos
Modifier and Type | Method and Description |
---|---|
HttpServerResponse |
addCookie(Cookie cookie)
Adds an outbound cookie
|
HttpServerResponse |
addHeader(CharSequence name,
CharSequence value)
Adds an outbound HTTP header, appending the value if the header already exist.
|
HttpServerResponse |
chunkedTransfer(boolean chunked)
Sets Transfer-Encoding header
|
HttpServerResponse |
compression(boolean compress)
Enables/Disables compression handling (gzip/deflate) for the underlying response
|
boolean |
hasSentHeaders()
Returns true if headers and status have been sent to the client
|
HttpServerResponse |
header(CharSequence name,
CharSequence value)
Sets an outbound HTTP header, replacing any pre-existing value.
|
HttpServerResponse |
headers(HttpHeaders headers)
Sets outbound HTTP headers, replacing any pre-existing value for these headers.
|
HttpServerResponse |
keepAlive(boolean keepAlive)
Sets the request
keepAlive if true otherwise remove the existing connection keep alive header |
HttpHeaders |
responseHeaders()
Returns the outbound HTTP headers, sent back to the clients
|
Mono<Void> |
send()
Sends the HTTP headers and empty content thus delimiting a full empty body http response.
|
NettyOutbound |
sendHeaders()
Returns a
NettyOutbound successful on committed response |
Mono<Void> |
sendNotFound()
Sends 404 status
HttpResponseStatus.NOT_FOUND . |
Mono<Void> |
sendRedirect(String location)
Sends redirect status
HttpResponseStatus.FOUND along with a location
header to the remote client. |
default Mono<Void> |
sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Upgrades the connection to websocket.
|
default Mono<Void> |
sendWebsocket(String protocols,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Upgrades the connection to websocket with optional subprotocol(s).
|
Mono<Void> |
sendWebsocket(String protocols,
int maxFramePayloadLength,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Upgrades the connection to websocket with optional subprotocol(s).
|
HttpServerResponse |
sse()
Adds "text/event-stream" content-type for Server-Sent Events
|
HttpResponseStatus |
status()
Returns the assigned HTTP status
|
HttpServerResponse |
status(HttpResponseStatus status)
Sets an HTTP status to be sent along with the headers
|
default HttpServerResponse |
status(int status)
Sets 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, send, sendByteArray, sendFile, sendFile, sendFileChunked, sendGroups, sendObject, sendObject, sendObject, sendString, sendString, sendUsing, subscribe, then, then, then
cookies, isKeepAlive, isWebsocket, method, path, uri, version
HttpServerResponse addCookie(Cookie cookie)
HttpServerResponse
HttpServerResponse addHeader(CharSequence name, CharSequence value)
name
- header namevalue
- header valueHttpServerResponse
HttpServerResponse chunkedTransfer(boolean chunked)
chunked
- true if Transfer-Encoding: chunkedHttpServerResponse
HttpServerResponse withConnection(java.util.function.Consumer<? super Connection> withConnection)
NettyOutbound
Connection
to operate on the underlying
Channel
state.withConnection
in interface NettyOutbound
withConnection
- connection callbackConnection
HttpServerResponse compression(boolean compress)
compress
- should handle compressionHttpServerResponse
boolean hasSentHeaders()
HttpServerResponse header(CharSequence name, CharSequence value)
name
- headers keyvalue
- header valueHttpServerResponse
HttpServerResponse headers(HttpHeaders headers)
headers
- netty headers mapHttpServerResponse
HttpServerResponse keepAlive(boolean keepAlive)
keepAlive
if true otherwise remove the existing connection keep alive headerHttpServerResponse
HttpHeaders responseHeaders()
Mono<Void> send()
Mono
successful on committed responseNettyOutbound.send(Publisher)
NettyOutbound sendHeaders()
NettyOutbound
successful on committed responseNettyOutbound
successful on committed responseMono<Void> sendNotFound()
HttpResponseStatus.NOT_FOUND
.Mono
successful on flush confirmationMono<Void> sendRedirect(String location)
HttpResponseStatus.FOUND
along with a location
header to the remote client.location
- the location to redirect toMono
successful on flush confirmationdefault Mono<Void> sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Mono
completing when the upgrade
is confirmed, then the provided callback is invoked, if the upgrade is not
successful the returned Mono
fails.websocketHandler
- the I/O handler for websocket transportMono
completing when upgrade is confirmed, otherwise failsdefault Mono<Void> sendWebsocket(@Nullable String protocols, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Mono
completing when the upgrade is confirmed, then the provided callback is invoked,
if the upgrade is not successful the returned Mono
fails.protocols
- optional sub-protocolwebsocketHandler
- the I/O handler for websocket transportMono
completing when upgrade is confirmed, otherwise failsMono<Void> sendWebsocket(@Nullable String protocols, int maxFramePayloadLength, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Mono
completing when the upgrade is confirmed, then the provided callback is invoked,
if the upgrade is not successful the returned Mono
fails.protocols
- optional sub-protocolmaxFramePayloadLength
- maximum allowable frame payload lengthwebsocketHandler
- the I/O handler for websocket transportMono
completing when upgrade is confirmed, otherwise failsHttpServerResponse sse()
HttpServerResponse
HttpResponseStatus status()
HttpServerResponse status(HttpResponseStatus status)
status
- an HTTP status to be sent along with the headersHttpServerResponse
default HttpServerResponse status(int status)
status
- an HTTP status to be sent along with the headersHttpServerResponse