public interface HttpServerResponse extends NettyOutbound, HttpInfos
Modifier and Type | Method and Description |
---|---|
HttpServerResponse |
addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
Adds an outbound cookie
|
HttpServerResponse |
addHeader(java.lang.CharSequence name,
java.lang.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(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets an outbound HTTP header, replacing any pre-existing value.
|
HttpServerResponse |
headers(io.netty.handler.codec.http.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 |
io.netty.handler.codec.http.HttpHeaders |
responseHeaders()
Returns the outbound HTTP headers, sent back to the clients
|
reactor.core.publisher.Mono<java.lang.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 |
reactor.core.publisher.Mono<java.lang.Void> |
sendNotFound()
Sends 404 status
HttpResponseStatus.NOT_FOUND . |
reactor.core.publisher.Mono<java.lang.Void> |
sendRedirect(java.lang.String location)
Sends redirect status
HttpResponseStatus.FOUND along with a location
header to the remote client. |
default reactor.core.publisher.Mono<java.lang.Void> |
sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends org.reactivestreams.Publisher<java.lang.Void>> websocketHandler)
Upgrades the connection to websocket.
|
reactor.core.publisher.Mono<java.lang.Void> |
sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends org.reactivestreams.Publisher<java.lang.Void>> websocketHandler,
WebsocketServerSpec websocketServerSpec)
Upgrades the connection to websocket.
|
HttpServerResponse |
sse()
Adds "text/event-stream" content-type for Server-Sent Events
|
io.netty.handler.codec.http.HttpResponseStatus |
status()
Returns the assigned HTTP status
|
HttpServerResponse |
status(io.netty.handler.codec.http.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, fullPath, isKeepAlive, isWebsocket, method, path, uri, version
HttpServerResponse addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
HttpServerResponse
HttpServerResponse addHeader(java.lang.CharSequence name, java.lang.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(java.lang.CharSequence name, java.lang.CharSequence value)
name
- headers keyvalue
- header valueHttpServerResponse
HttpServerResponse headers(io.netty.handler.codec.http.HttpHeaders headers)
headers
- netty headers mapHttpServerResponse
HttpServerResponse keepAlive(boolean keepAlive)
keepAlive
if true otherwise remove the existing connection keep alive headerHttpServerResponse
io.netty.handler.codec.http.HttpHeaders responseHeaders()
reactor.core.publisher.Mono<java.lang.Void> send()
Mono
successful on committed responseNettyOutbound.send(Publisher)
NettyOutbound sendHeaders()
NettyOutbound
successful on committed responseNettyOutbound
successful on committed responsereactor.core.publisher.Mono<java.lang.Void> sendNotFound()
HttpResponseStatus.NOT_FOUND
.Mono
successful on flush confirmationreactor.core.publisher.Mono<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 reactor.core.publisher.Mono<java.lang.Void> sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends org.reactivestreams.Publisher<java.lang.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 failsreactor.core.publisher.Mono<java.lang.Void> sendWebsocket(java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends org.reactivestreams.Publisher<java.lang.Void>> websocketHandler, WebsocketServerSpec websocketServerSpec)
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 transportwebsocketServerSpec
- WebsocketServerSpec
for websocket configurationMono
completing when upgrade is confirmed, otherwise failsHttpServerResponse sse()
HttpServerResponse
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 headersHttpServerResponse
default HttpServerResponse status(int status)
status
- an HTTP status to be sent along with the headersHttpServerResponse