public interface HttpServerResponse extends NettyOutbound, HttpInfos
Modifier and Type | Method and Description |
---|---|
HttpServerResponse |
addCookie(Cookie cookie)
Add an outbound cookie
|
HttpServerResponse |
addHeader(CharSequence name,
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(CharSequence name,
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 |
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
|
Mono<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<Void> |
sendNotFound()
Send 404 status
HttpResponseStatus.NOT_FOUND . |
Mono<Void> |
sendRedirect(String location)
Send 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)
Upgrade connection to Websocket.
|
default Mono<Void> |
sendWebsocket(String protocols,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Upgrade 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)
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
|
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, then
cookies, isKeepAlive, isWebsocket, method, path, uri, version
HttpServerResponse addCookie(Cookie cookie)
HttpServerResponse addHeader(CharSequence name, CharSequence value)
name
- header namevalue
- header valueHttpServerResponse chunkedTransfer(boolean chunked)
chunked
- true if transfer-encoding:chunkedHttpServerResponse 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 compressionboolean hasSentHeaders()
HttpServerResponse header(CharSequence name, CharSequence value)
name
- headers keyvalue
- header valueHttpServerResponse headers(HttpHeaders headers)
headers
- netty headers mapHttpServerResponse keepAlive(boolean keepAlive)
default HttpServerResponse options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
NettyOutbound
NettyOutbound
scoped configuration for sending. The
NettyPipeline.SendOptions
changes will apply to the next written object or
Publisher
.options
in interface NettyOutbound
configurator
- the callback invoked to retrieve send configurationthis
instanceHttpHeaders 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
fails.websocketHandler
- the in/out handler for ws transportMono
completing when upgrade is confirmeddefault Mono<Void> sendWebsocket(@Nullable String protocols, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> websocketHandler)
Mono
fails.protocols
- optional sub-protocolwebsocketHandler
- the in/out handler for ws transportMono
completing when upgrade is confirmedMono<Void> sendWebsocket(@Nullable String protocols, int maxFramePayloadLength, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<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()
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