Class HttpServerResponse
- java.lang.Object
-
- io.vertx.mutiny.core.http.HttpServerResponse
-
- All Implemented Interfaces:
StreamBase,WriteStream<Buffer>
public class HttpServerResponse extends Object implements WriteStream<Buffer>
Represents a server-side HTTP response.An instance of this is created and associated to every instance of
HttpServerRequestthat.It allows the developer to control the HTTP response that is sent back to the client for a particular HTTP request.
It contains methods that allow HTTP headers and trailers to be set, and for a body to be written out to the response.
It also allows files to be streamed by the kernel directly from disk to the outgoing HTTP connection, bypassing user space altogether (where supported by the underlying operating system). This is a very efficient way of serving files from the server since buffers do not have to be read one by one from the file and written to the outgoing socket.
It implements
NOTE: This class has been automatically generated from theWriteStreamso it can be used withPumpto pump data with flow control.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<HttpServerResponse>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description HttpServerResponse(io.vertx.core.http.HttpServerResponse delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpServerResponseaddCookie(Cookie cookie)HttpServerResponsebodyEndHandler(Consumer<Void> handler)longbytesWritten()voidclose()booleanclosed()HttpServerResponsecloseHandler(Consumer<Void> handler)HttpServerResponsedrainHandler(Consumer<Void> handler)io.smallrye.mutiny.Uni<Void>end()Same asend()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>end(Buffer chunk)Same asend()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>end(String chunk)Same asend()but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>end(String chunk, String enc)Same asend()but with anhandlercalled when the operation completesVoidendAndAwait()Blocking variant ofWriteStream.end().VoidendAndAwait(Buffer chunk)Blocking variant ofend(io.vertx.mutiny.core.buffer.Buffer).VoidendAndAwait(String chunk)Blocking variant ofend(String).VoidendAndAwait(String chunk, String enc)Blocking variant ofend(String,String).voidendAndForget()Variant ofend()that ignores the result of the operation.voidendAndForget(Buffer chunk)Variant ofend(io.vertx.mutiny.core.buffer.Buffer)that ignores the result of the operation.voidendAndForget(String chunk)Variant ofend(String)that ignores the result of the operation.voidendAndForget(String chunk, String enc)Variant ofend(String,String)that ignores the result of the operation.booleanended()HttpServerResponseendHandler(Consumer<Void> handler)booleanequals(Object o)HttpServerResponseexceptionHandler(Consumer<Throwable> handler)io.vertx.core.http.HttpServerResponsegetDelegate()intgetStatusCode()StringgetStatusMessage()inthashCode()MultiMapheaders()HttpServerResponseheadersEndHandler(Consumer<Void> handler)booleanheadWritten()booleanisChunked()static HttpServerResponsenewInstance(io.vertx.core.http.HttpServerResponse arg)io.smallrye.mutiny.Uni<HttpServerResponse>push(io.vertx.core.http.HttpMethod method, String path)Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with the host copied from the current request.io.smallrye.mutiny.Uni<HttpServerResponse>push(io.vertx.core.http.HttpMethod method, String path, MultiMap headers)Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with the host copied from the current request.io.smallrye.mutiny.Uni<HttpServerResponse>push(io.vertx.core.http.HttpMethod method, String host, String path)Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with no headers.io.smallrye.mutiny.Uni<HttpServerResponse>push(io.vertx.core.http.HttpMethod method, String host, String path, MultiMap headers)Push a response to the client.HttpServerResponsepushAndAwait(io.vertx.core.http.HttpMethod method, String path)Blocking variant ofpush(HttpMethod,String).HttpServerResponsepushAndAwait(io.vertx.core.http.HttpMethod method, String path, MultiMap headers)Blocking variant ofpush(HttpMethod,String,io.vertx.mutiny.core.MultiMap).HttpServerResponsepushAndAwait(io.vertx.core.http.HttpMethod method, String host, String path)Blocking variant ofpush(HttpMethod,String,String).HttpServerResponsepushAndAwait(io.vertx.core.http.HttpMethod method, String host, String path, MultiMap headers)Blocking variant ofpush(HttpMethod,String,String,io.vertx.mutiny.core.MultiMap).HttpServerResponseputHeader(CharSequence name, CharSequence value)HttpServerResponseputHeader(CharSequence name, Iterable<CharSequence> values)HttpServerResponseputHeader(String name, Iterable<String> values)HttpServerResponseputHeader(String name, String value)HttpServerResponseputTrailer(CharSequence name, CharSequence value)HttpServerResponseputTrailer(CharSequence name, Iterable<CharSequence> value)HttpServerResponseputTrailer(String name, Iterable<String> values)HttpServerResponseputTrailer(String name, String value)CookieremoveCookie(String name)CookieremoveCookie(String name, boolean invalidate)voidreset()voidreset(long code)io.smallrye.mutiny.Uni<Void>sendFile(String filename)LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.io.smallrye.mutiny.Uni<Void>sendFile(String filename, long offset)LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.io.smallrye.mutiny.Uni<Void>sendFile(String filename, long offset, long length)LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.VoidsendFileAndAwait(String filename)Blocking variant ofsendFile(String).VoidsendFileAndAwait(String filename, long offset)Blocking variant ofsendFile(String,long).VoidsendFileAndAwait(String filename, long offset, long length)Blocking variant ofsendFile(String,long,long).HttpServerResponsesendFileAndForget(String filename)Variant ofsendFile(String)that ignores the result of the operation.HttpServerResponsesendFileAndForget(String filename, long offset)Variant ofsendFile(String,long)that ignores the result of the operation.HttpServerResponsesendFileAndForget(String filename, long offset, long length)Variant ofsendFile(String,long,long)that ignores the result of the operation.HttpServerResponsesetChunked(boolean chunked)HttpServerResponsesetStatusCode(int statusCode)HttpServerResponsesetStatusMessage(String statusMessage)HttpServerResponsesetStreamPriority(io.vertx.core.http.StreamPriority streamPriority)HttpServerResponsesetWriteQueueMaxSize(int maxSize)intstreamId()StringtoString()WriteStreamSubscriber<Buffer>toSubscriber()MultiMaptrailers()io.smallrye.mutiny.Uni<Void>write(Buffer data)Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>write(String chunk)Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesio.smallrye.mutiny.Uni<Void>write(String chunk, String enc)Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesVoidwriteAndAwait(Buffer data)Blocking variant ofwrite(io.vertx.mutiny.core.buffer.Buffer).VoidwriteAndAwait(String chunk)Blocking variant ofwrite(String).VoidwriteAndAwait(String chunk, String enc)Blocking variant ofwrite(String,String).HttpServerResponsewriteAndForget(Buffer data)HttpServerResponsewriteAndForget(String chunk)Variant ofwrite(String)that ignores the result of the operation.HttpServerResponsewriteAndForget(String chunk, String enc)Variant ofwrite(String,String)that ignores the result of the operation.HttpServerResponsewriteContinue()HttpServerResponsewriteCustomFrame(int type, int flags, Buffer payload)HttpServerResponsewriteCustomFrame(HttpFrame frame)booleanwriteQueueFull()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HttpServerResponse> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.HttpServerResponse getDelegate()
- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWriteStream<Buffer>
-
toSubscriber
public WriteStreamSubscriber<Buffer> toSubscriber()
-
end
public io.smallrye.mutiny.Uni<Void> end()
Same asend()but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Specified by:
endin interfaceWriteStream<Buffer>- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait()
Blocking variant ofWriteStream.end().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
endAndAwaitin interfaceWriteStream<Buffer>- Returns:
- the Void instance produced by the operation
-
writeQueueFull
public boolean writeQueueFull()
- Specified by:
writeQueueFullin interfaceWriteStream<Buffer>- Returns:
- true if write queue is full
-
exceptionHandler
public HttpServerResponse exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
write
public io.smallrye.mutiny.Uni<Void> write(Buffer data)
Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Specified by:
writein interfaceWriteStream<Buffer>- Parameters:
data-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
public Void writeAndAwait(Buffer data)
Blocking variant ofwrite(io.vertx.mutiny.core.buffer.Buffer).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
writeAndAwaitin interfaceWriteStream<Buffer>- Parameters:
data-- Returns:
- the Void instance produced by the operation
-
setWriteQueueMaxSize
public HttpServerResponse setWriteQueueMaxSize(int maxSize)
- Specified by:
setWriteQueueMaxSizein interfaceWriteStream<Buffer>- Parameters:
maxSize- the max size of the write stream- Returns:
- a reference to this, so the API can be used fluently
-
drainHandler
public HttpServerResponse drainHandler(Consumer<Void> handler)
- Specified by:
drainHandlerin interfaceWriteStream<Buffer>- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
getStatusCode
public int getStatusCode()
- Returns:
- the HTTP status code of the response. The default is
200representingOK.
-
setStatusCode
public HttpServerResponse setStatusCode(int statusCode)
- Parameters:
statusCode-- Returns:
- a reference to this, so the API can be used fluently
-
getStatusMessage
public String getStatusMessage()
- Returns:
- the HTTP status message of the response. If this is not specified a default value will be used depending on what
setStatusCode(int)has been set to.
-
setStatusMessage
public HttpServerResponse setStatusMessage(String statusMessage)
- Parameters:
statusMessage-- Returns:
- a reference to this, so the API can be used fluently
-
setChunked
public HttpServerResponse setChunked(boolean chunked)
- Parameters:
chunked-- Returns:
- a reference to this, so the API can be used fluently
-
isChunked
public boolean isChunked()
- Returns:
- is the response chunked?
-
headers
public MultiMap headers()
- Returns:
- The HTTP headers
-
putHeader
public HttpServerResponse putHeader(String name, String value)
- Parameters:
name- the header namevalue- the header value.- Returns:
- a reference to this, so the API can be used fluently
-
trailers
public MultiMap trailers()
- Returns:
- The HTTP trailers
-
putTrailer
public HttpServerResponse putTrailer(String name, String value)
- Parameters:
name- the trailer namevalue- the trailer value- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
public HttpServerResponse closeHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public HttpServerResponse endHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
write
public io.smallrye.mutiny.Uni<Void> write(String chunk, String enc)
Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
chunk-enc-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
public Void writeAndAwait(String chunk, String enc)
Blocking variant ofwrite(String,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
chunk-enc-- Returns:
- the Void instance produced by the operation
-
write
public io.smallrye.mutiny.Uni<Void> write(String chunk)
Same aswrite(io.vertx.mutiny.core.buffer.Buffer)but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
chunk-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
writeAndAwait
public Void writeAndAwait(String chunk)
Blocking variant ofwrite(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
chunk-- Returns:
- the Void instance produced by the operation
-
writeContinue
public HttpServerResponse writeContinue()
- Returns:
- a reference to this, so the API can be used fluently
-
end
public io.smallrye.mutiny.Uni<Void> end(String chunk)
Same asend()but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
chunk-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait(String chunk)
Blocking variant ofend(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
chunk-- Returns:
- the Void instance produced by the operation
-
end
public io.smallrye.mutiny.Uni<Void> end(String chunk, String enc)
Same asend()but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
chunk-enc-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait(String chunk, String enc)
Blocking variant ofend(String,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
chunk-enc-- Returns:
- the Void instance produced by the operation
-
end
public io.smallrye.mutiny.Uni<Void> end(Buffer chunk)
Same asend()but with anhandlercalled when the operation completesUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Specified by:
endin interfaceWriteStream<Buffer>- Parameters:
chunk-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
endAndAwait
public Void endAndAwait(Buffer chunk)
Blocking variant ofend(io.vertx.mutiny.core.buffer.Buffer).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
endAndAwaitin interfaceWriteStream<Buffer>- Parameters:
chunk-- Returns:
- the Void instance produced by the operation
-
sendFile
public io.smallrye.mutiny.Uni<Void> sendFile(String filename)
LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
filename- path to the file to serve- Returns:
- a reference to this, so the API can be used fluently
-
sendFileAndAwait
public Void sendFileAndAwait(String filename)
Blocking variant ofsendFile(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filename- path to the file to serve- Returns:
- a reference to this, so the API can be used fluently
-
sendFile
public io.smallrye.mutiny.Uni<Void> sendFile(String filename, long offset)
LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
filename- path to the file to serveoffset- the offset to serve from- Returns:
- a reference to this, so the API can be used fluently
-
sendFileAndAwait
public Void sendFileAndAwait(String filename, long offset)
Blocking variant ofsendFile(String,long).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filename- path to the file to serveoffset- the offset to serve from- Returns:
- a reference to this, so the API can be used fluently
-
sendFile
public io.smallrye.mutiny.Uni<Void> sendFile(String filename, long offset, long length)
LikesendFile(java.lang.String)but providing a handler which will be notified once the file has been completely written to the wire.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
filename- path to the file to serveoffset- the offset to serve fromlength- the length to serve to- Returns:
- a reference to this, so the API can be used fluently
-
sendFileAndAwait
public Void sendFileAndAwait(String filename, long offset, long length)
Blocking variant ofsendFile(String,long,long).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
filename- path to the file to serveoffset- the offset to serve fromlength- the length to serve to- Returns:
- a reference to this, so the API can be used fluently
-
close
public void close()
-
ended
public boolean ended()
- Returns:
- has the response already ended?
-
closed
public boolean closed()
- Returns:
- has the underlying TCP connection corresponding to the request already been closed?
-
headWritten
public boolean headWritten()
- Returns:
- have the headers for the response already been written?
-
headersEndHandler
public HttpServerResponse headersEndHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
bodyEndHandler
public HttpServerResponse bodyEndHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
bytesWritten
public long bytesWritten()
- Returns:
- the total number of bytes written for the body of the response.
-
streamId
public int streamId()
- Returns:
- the id of the stream of this response, for HTTP/1.x
-
push
public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String host, String path)
Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with no headers.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
method-host-path-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, String host, String path)
Blocking variant ofpush(HttpMethod,String,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
method-host-path-- Returns:
- the HttpServerResponse instance produced by the operation
-
push
public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String path, MultiMap headers)
Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
method-path-headers-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, String path, MultiMap headers)
Blocking variant ofpush(HttpMethod,String,io.vertx.mutiny.core.MultiMap).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
method-path-headers-- Returns:
- the HttpServerResponse instance produced by the operation
-
push
public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String path)
Likepush(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
method-path-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, String path)
Blocking variant ofpush(HttpMethod,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
method-path-- Returns:
- the HttpServerResponse instance produced by the operation
-
push
public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String host, String path, MultiMap headers)
Push a response to the client. Thehandlerwill be notified with a success when the push can be sent and with a failure when the client has disabled push or reset the push before it has been sent. Thehandlermay be queued if the client has reduced the maximum number of streams the server can push concurrently. Push can be sent only for peer initiated streams and if the response is not ended.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
method- the method of the promised requesthost- the host of the promised requestpath- the path of the promised requestheaders- the headers of the promised request- Returns:
- a reference to this, so the API can be used fluently
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, String host, String path, MultiMap headers)
Blocking variant ofpush(HttpMethod,String,String,io.vertx.mutiny.core.MultiMap).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
method- the method of the promised requesthost- the host of the promised requestpath- the path of the promised requestheaders- the headers of the promised request- Returns:
- a reference to this, so the API can be used fluently
-
reset
public void reset()
-
reset
public void reset(long code)
- Parameters:
code- the error code
-
writeCustomFrame
public HttpServerResponse writeCustomFrame(int type, int flags, Buffer payload)
- Parameters:
type- the 8-bit frame typeflags- the 8-bit frame flagspayload- the frame payload- Returns:
- a reference to this, so the API can be used fluently
-
writeCustomFrame
public HttpServerResponse writeCustomFrame(HttpFrame frame)
- Parameters:
frame- the frame to write- Returns:
-
setStreamPriority
public HttpServerResponse setStreamPriority(io.vertx.core.http.StreamPriority streamPriority)
- Parameters:
streamPriority- the priority for this request's stream- Returns:
-
addCookie
public HttpServerResponse addCookie(Cookie cookie)
- Parameters:
cookie- the cookie- Returns:
- a reference to this, so the API can be used fluently
-
removeCookie
public Cookie removeCookie(String name)
- Parameters:
name- the name of the cookie- Returns:
- the cookie, if it existed, or null
-
removeCookie
public Cookie removeCookie(String name, boolean invalidate)
- Parameters:
name- the name of the cookieinvalidate-- Returns:
- the cookie, if it existed, or null
-
putHeader
public HttpServerResponse putHeader(CharSequence name, CharSequence value)
- Parameters:
name-value-- Returns:
-
putHeader
public HttpServerResponse putHeader(String name, Iterable<String> values)
- Parameters:
name-values-- Returns:
-
putHeader
public HttpServerResponse putHeader(CharSequence name, Iterable<CharSequence> values)
- Parameters:
name-values-- Returns:
-
putTrailer
public HttpServerResponse putTrailer(CharSequence name, CharSequence value)
- Parameters:
name-value-- Returns:
-
putTrailer
public HttpServerResponse putTrailer(String name, Iterable<String> values)
- Parameters:
name-values-- Returns:
-
putTrailer
public HttpServerResponse putTrailer(CharSequence name, Iterable<CharSequence> value)
- Parameters:
name-value-- Returns:
-
writeAndForget
public HttpServerResponse writeAndForget(Buffer data)
-
writeAndForget
public HttpServerResponse writeAndForget(String chunk, String enc)
Variant ofwrite(String,String)that ignores the result of the operation.This method subscribes on the result of
write(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromwrite(String,String)but you don't need to compose it with other operations.- Parameters:
chunk- the string to writeenc- the encoding to use- Returns:
- a reference to this, so the API can be used fluently
-
writeAndForget
public HttpServerResponse writeAndForget(String chunk)
Variant ofwrite(String)that ignores the result of the operation.This method subscribes on the result of
write(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromwrite(String)but you don't need to compose it with other operations.- Parameters:
chunk- the string to write- Returns:
- a reference to this, so the API can be used fluently
-
endAndForget
public void endAndForget(String chunk)
Variant ofend(String)that ignores the result of the operation.This method subscribes on the result of
end(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromend(String)but you don't need to compose it with other operations.- Parameters:
chunk- the string to write before ending the response
-
endAndForget
public void endAndForget(String chunk, String enc)
Variant ofend(String,String)that ignores the result of the operation.This method subscribes on the result of
end(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromend(String,String)but you don't need to compose it with other operations.- Parameters:
chunk- the string to write before ending the responseenc- the encoding to use
-
endAndForget
public void endAndForget(Buffer chunk)
Variant ofend(io.vertx.mutiny.core.buffer.Buffer)that ignores the result of the operation.This method subscribes on the result of
end(io.vertx.mutiny.core.buffer.Buffer), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromend(io.vertx.mutiny.core.buffer.Buffer)but you don't need to compose it with other operations.- Parameters:
chunk- the buffer to write before ending the response
-
endAndForget
public void endAndForget()
-
sendFileAndForget
public HttpServerResponse sendFileAndForget(String filename)
Variant ofsendFile(String)that ignores the result of the operation.This method subscribes on the result of
sendFile(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsendFile(String)but you don't need to compose it with other operations.- Parameters:
filename- path to the file to serve- Returns:
- a reference to this, so the API can be used fluently
-
sendFileAndForget
public HttpServerResponse sendFileAndForget(String filename, long offset)
Variant ofsendFile(String,long)that ignores the result of the operation.This method subscribes on the result of
sendFile(String,long), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsendFile(String,long)but you don't need to compose it with other operations.- Parameters:
filename- path to the file to serveoffset- offset to start serving from- Returns:
- a reference to this, so the API can be used fluently
-
sendFileAndForget
public HttpServerResponse sendFileAndForget(String filename, long offset, long length)
Variant ofsendFile(String,long,long)that ignores the result of the operation.This method subscribes on the result of
sendFile(String,long,long), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsendFile(String,long,long)but you don't need to compose it with other operations.- Parameters:
filename- path to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
public static HttpServerResponse newInstance(io.vertx.core.http.HttpServerResponse arg)
-
-