Class HttpServerResponse
- All Implemented Interfaces:
MutinyDelegate,StreamBase,WriteStream<io.vertx.core.buffer.Buffer>
An instance of this is created and associated to every instance of
HttpServerRequest that.
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. If the developer wants to use directly a
FileChannel and manage its lifecycle use sendFile(FileChannel).
This is not yet supported in HTTP/2 for HttpServerResponseImpl.
It implements WriteStream so it can be used with
Pipe to pipe data with flow control.
Any response should end with a terminal action, which are end() or sendFile(String) for successful
completion of the request, or reset() for erroneous completion of the request, so you can only call one of
the three methods as the last step in dealing with your response, but you must call one of the three methods.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Tim Fox
- See Also:
-
HttpServerResponse
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.StreamBase
StreamBase.StreamBaseImplNested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.WriteStream
WriteStream.WriteStreamImpl<T> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpServerResponse(io.vertx.core.http.HttpServerResponse delegate) Create a new instance ofHttpServerResponsedelegating to the given (non-null) instance ofHttpServerResponse.HttpServerResponse(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionaddCookie(io.vertx.core.http.Cookie cookie) Add a cookie.bodyEndHandler(Runnable handler) Provides a handler that will be called after the last part of the body is written to the wire.longio.smallrye.mutiny.Uni<Boolean>cancel()Attempt to cancel the request according to the semantics of the underlying HTTP implementation.Attempt to cancel the request according to the semantics of the underlying HTTP implementation.Attempt to cancel the request according to the semantics of the underlying HTTP implementation.booleanclosed()closeHandler(Runnable handler) Set a close handler for the response, this is called when the underlying connection is closed and the response was still using the connection.drainHandler(Runnable handler) Set a drain handler on the stream.io.smallrye.mutiny.Uni<Void>end()Ends the response.io.smallrye.mutiny.Uni<Void>end(io.vertx.core.buffer.Buffer chunk) Same asend()but writes some data to the response body before ending.io.smallrye.mutiny.Uni<Void>Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.io.smallrye.mutiny.Uni<Void>Same asend(Buffer)but writes a String with the specified encoding before ending the response.voidEnds the response.voidendAndAwait(io.vertx.core.buffer.Buffer chunk) Same asend()but writes some data to the response body before ending.voidendAndAwait(String chunk) Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.voidendAndAwait(String chunk, String enc) Same asend(Buffer)but writes a String with the specified encoding before ending the response.Ends the response.endAndForget(io.vertx.core.buffer.Buffer chunk) Same asend()but writes some data to the response body before ending.endAndForget(String chunk) Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.endAndForget(String chunk, String enc) Same asend(Buffer)but writes a String with the specified encoding before ending the response.booleanended()endHandler(Runnable handler) Set an end handler for the response.booleanexceptionHandler(Consumer<Throwable> handler) Set an exception handler on the write stream.io.vertx.core.http.HttpServerResponseGet the delegate instance.intinthashCode()io.vertx.core.MultiMapheaders()headersEndHandler(Runnable handler) Provide a handler that will be called just before the headers are written to the wire.booleanbooleanstatic HttpServerResponsenewInstance(io.vertx.core.http.HttpServerResponse delegate) Creates a new instance of theHttpServerResponse.io.smallrye.mutiny.Uni<HttpServerResponse>Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.io.smallrye.mutiny.Uni<HttpServerResponse>push(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.MultiMap headers) Push a response to the client.io.smallrye.mutiny.Uni<HttpServerResponse>Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.io.smallrye.mutiny.Uni<HttpServerResponse>Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.pushAndAwait(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.pushAndAwait(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.MultiMap headers) Push a response to the client.pushAndAwait(io.vertx.core.http.HttpMethod method, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.pushAndAwait(io.vertx.core.http.HttpMethod method, String path, io.vertx.core.MultiMap headers) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.pushAndForget(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.pushAndForget(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.MultiMap headers) Push a response to the client.pushAndForget(io.vertx.core.http.HttpMethod method, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.pushAndForget(io.vertx.core.http.HttpMethod method, String path, io.vertx.core.MultiMap headers) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.putHeader(CharSequence name, CharSequence value) LikeputHeader(String, String)but using CharSequenceputHeader(CharSequence name, Iterable<CharSequence> values) LikeputHeader(String, Iterable)but with CharSequence IterableLikeputHeader(String, String)but providing multiple values via a String IterablePut an HTTP headerputTrailer(CharSequence name, CharSequence value) LikeputTrailer(String, String)but using CharSequenceputTrailer(CharSequence name, Iterable<CharSequence> value) LikeputTrailer(String, Iterable)but with CharSequence IterableputTrailer(String name, Iterable<String> values) LikeputTrailer(String, String)but providing multiple values via a String IterableputTrailer(String name, String value) Put an HTTP trailerio.vertx.core.http.CookieremoveCookie(String name) Expire a cookie, notifying a User Agent to remove it from its cookie jar.io.vertx.core.http.CookieremoveCookie(String name, boolean invalidate) Remove a cookie from the cookie set.io.vertx.core.http.CookieremoveCookie(String name, String domain, String path) Expires a cookie from the cookie set.io.vertx.core.http.CookieremoveCookie(String name, String domain, String path, boolean invalidate) Remove a cookie from the cookie set.Set<io.vertx.core.http.Cookie>removeCookies(String name) Expire all cookies, notifying a User Agent to remove it from its cookie jar.Set<io.vertx.core.http.Cookie>removeCookies(String name, boolean invalidate) Remove all cookies from the cookie set.io.smallrye.mutiny.Uni<Void>reset()Equivalent to callingreset(long)with0.io.smallrye.mutiny.Uni<Void>reset(long code) Reset this response:voidEquivalent to callingreset(long)with0.voidresetAndAwait(long code) Reset this response:Equivalent to callingreset(long)with0.resetAndForget(long code) Reset this response:io.smallrye.mutiny.Uni<Void>send()Send the request with an empty body.io.smallrye.mutiny.Uni<Void>send(io.vertx.core.buffer.Buffer body) Send the request with a bufferbody.io.smallrye.mutiny.Uni<Void>send(ReadStream<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.io.smallrye.mutiny.Uni<Void>Send the request with a stringbody.io.smallrye.mutiny.Uni<Void>send(Flow.Publisher<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.voidSend the request with an empty body.voidsendAndAwait(io.vertx.core.buffer.Buffer body) Send the request with a bufferbody.voidsendAndAwait(ReadStream<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.voidsendAndAwait(String body) Send the request with a stringbody.voidsendAndAwait(Flow.Publisher<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.Send the request with an empty body.sendAndForget(io.vertx.core.buffer.Buffer body) Send the request with a bufferbody.sendAndForget(ReadStream<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.sendAndForget(String body) Send the request with a stringbody.sendAndForget(Flow.Publisher<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.io.smallrye.mutiny.Uni<Void>sendFile(RandomAccessFile file) Same assendFile(FileChannel)withRandomAccessFileio.smallrye.mutiny.Uni<Void>sendFile(RandomAccessFile file, long offset) Same assendFile(FileChannel, long)withRandomAccessFileio.smallrye.mutiny.Uni<Void>sendFile(RandomAccessFile file, long offset, long length) Same assendFile(FileChannel, long, long)withRandomAccessFileio.smallrye.mutiny.Uni<Void>Send the request with a streambody.io.smallrye.mutiny.Uni<Void>Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.io.smallrye.mutiny.Uni<Void>Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.io.smallrye.mutiny.Uni<Void>sendFile(FileChannel channel) Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.io.smallrye.mutiny.Uni<Void>sendFile(FileChannel channel, long offset) Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.io.smallrye.mutiny.Uni<Void>sendFile(FileChannel channel, long offset, long length) Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system).voidSame assendFile(FileChannel)withRandomAccessFilevoidsendFileAndAwait(RandomAccessFile file, long offset) Same assendFile(FileChannel, long)withRandomAccessFilevoidsendFileAndAwait(RandomAccessFile file, long offset, long length) Same assendFile(FileChannel, long, long)withRandomAccessFilevoidsendFileAndAwait(String filename) Send the request with a streambody.voidsendFileAndAwait(String filename, long offset) Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.voidsendFileAndAwait(String filename, long offset, long length) Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.voidsendFileAndAwait(FileChannel channel) Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.voidsendFileAndAwait(FileChannel channel, long offset) Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.voidsendFileAndAwait(FileChannel channel, long offset, long length) Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system).Same assendFile(FileChannel)withRandomAccessFilesendFileAndForget(RandomAccessFile file, long offset) Same assendFile(FileChannel, long)withRandomAccessFilesendFileAndForget(RandomAccessFile file, long offset, long length) Same assendFile(FileChannel, long, long)withRandomAccessFilesendFileAndForget(String filename) Send the request with a streambody.sendFileAndForget(String filename, long offset) Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.sendFileAndForget(String filename, long offset, long length) Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.sendFileAndForget(FileChannel channel) Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.sendFileAndForget(FileChannel channel, long offset) Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.sendFileAndForget(FileChannel channel, long offset, long length) Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system).setChunked(boolean chunked) Ifchunkedistrue, this response will use HTTP chunked encoding, and each call to write to the body will correspond to a new HTTP chunk sent on the wire.setStatusCode(int statusCode) Set the status code.setStatusMessage(String statusMessage) Set the status messagesetStreamPriority(io.vertx.core.http.StreamPriority streamPriority) Sets the priority of the associated streamsetWriteQueueMaxSize(int maxSize) Set the maximum size of the write queue tomaxSize.longstreamId()toString()Flow.Subscriber<io.vertx.core.buffer.Buffer>Converts the current write stream to a subscriber.io.vertx.core.MultiMaptrailers()io.smallrye.mutiny.Uni<Void>write(io.vertx.core.buffer.Buffer arg0) Write some data to the stream.io.smallrye.mutiny.Uni<Void>Write aStringto the response body, encoded in UTF-8.io.smallrye.mutiny.Uni<Void>Write aStringto the response body, encoded using the encodingenc.io.smallrye.mutiny.Uni<Void>writeAltSvc(String advertisement) Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.voidwriteAltSvcAndAwait(String advertisement) Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.writeAltSvcAndForget(String advertisement) Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.voidwriteAndAwait(io.vertx.core.buffer.Buffer arg0) Write some data to the stream.voidwriteAndAwait(String chunk) Write aStringto the response body, encoded in UTF-8.voidwriteAndAwait(String chunk, String enc) Write aStringto the response body, encoded using the encodingenc.writeAndForget(io.vertx.core.buffer.Buffer arg0) Write some data to the stream.writeAndForget(String chunk) Write aStringto the response body, encoded in UTF-8.writeAndForget(String chunk, String enc) Write aStringto the response body, encoded using the encodingenc.io.smallrye.mutiny.Uni<Void>Used to write an interim 100 Continue response to signify that the client should send the rest of the request.voidUsed to write an interim 100 Continue response to signify that the client should send the rest of the request.Used to write an interim 100 Continue response to signify that the client should send the rest of the request.io.smallrye.mutiny.Uni<Void>writeCustomFrame(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.io.smallrye.mutiny.Uni<Void>writeCustomFrame(io.vertx.core.http.HttpFrame frame) LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.voidwriteCustomFrameAndAwait(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.voidwriteCustomFrameAndAwait(io.vertx.core.http.HttpFrame frame) LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.writeCustomFrameAndForget(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.writeCustomFrameAndForget(io.vertx.core.http.HttpFrame frame) LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.io.smallrye.mutiny.Uni<Void>writeEarlyHints(io.vertx.core.MultiMap headers) Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.voidwriteEarlyHintsAndAwait(io.vertx.core.MultiMap headers) Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.writeEarlyHintsAndForget(io.vertx.core.MultiMap headers) Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.io.smallrye.mutiny.Uni<Void>Send the response headers.voidSend the response headers.Send the response headers.booleanThis will returntrueif there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
HttpServerResponse
public HttpServerResponse(io.vertx.core.http.HttpServerResponse delegate) Create a new instance ofHttpServerResponsedelegating to the given (non-null) instance ofHttpServerResponse. -
HttpServerResponse
-
-
Method Details
-
getDelegate
public io.vertx.core.http.HttpServerResponse getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWriteStream<io.vertx.core.buffer.Buffer>- Returns:
- the delegate instance
-
writeHead
Send the response headers.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeHead()
-
writeHeadAndAwait
public void writeHeadAndAwait()Send the response headers.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.writeHead()
-
writeHeadAndForget
Send the response headers.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeHead()
-
write
Write aStringto the response body, encoded using the encodingenc.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
chunk- the string to writeenc- the encoding to use- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.write(String, String)
-
writeAndAwait
Write aStringto the response body, encoded using the encodingenc.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
chunk- the string to writeenc- the encoding to use- See Also:
-
HttpServerResponse.write(String, String)
-
writeAndForget
Write aStringto the response body, encoded using the encodingenc.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
chunk- the string to writeenc- the encoding to use- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.write(String, String)
-
write
Write aStringto the response body, encoded in UTF-8.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
chunk- the string to write- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.write(String)
-
writeAndAwait
Write aStringto the response body, encoded in UTF-8.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
chunk- the string to write- See Also:
-
HttpServerResponse.write(String)
-
writeAndForget
Write aStringto the response body, encoded in UTF-8.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
chunk- the string to write- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.write(String)
-
writeContinue
Used to write an interim 100 Continue response to signify that the client should send the rest of the request. Must only be used if the request contains an "Expect:100-Continue" headerUnlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeContinue()
-
writeContinueAndAwait
public void writeContinueAndAwait()Used to write an interim 100 Continue response to signify that the client should send the rest of the request. Must only be used if the request contains an "Expect:100-Continue" headerUnlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.writeContinue()
-
writeContinueAndForget
Used to write an interim 100 Continue response to signify that the client should send the rest of the request. Must only be used if the request contains an "Expect:100-Continue" headerUnlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeContinue()
-
writeEarlyHints
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeEarlyHints(io.vertx.core.MultiMap headers) Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
headers- headers to write- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeEarlyHints(MultiMap)
-
writeEarlyHintsAndAwait
public void writeEarlyHintsAndAwait(io.vertx.core.MultiMap headers) Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
headers- headers to write- See Also:
-
HttpServerResponse.writeEarlyHints(MultiMap)
-
writeEarlyHintsAndForget
Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
headers- headers to write- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeEarlyHints(MultiMap)
-
end
Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
chunk- the string to write before ending the response- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.end(String)
-
endAndAwait
Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
chunk- the string to write before ending the response- See Also:
-
HttpServerResponse.end(String)
-
endAndForget
Same asend(Buffer)but writes a String in UTF-8 encoding before ending the response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
chunk- the string to write before ending the response- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.end(String)
-
end
Same asend(Buffer)but writes a String with the specified encoding before ending the response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
chunk- the string to write before ending the responseenc- the encoding to use- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.end(String, String)
-
endAndAwait
Same asend(Buffer)but writes a String with the specified encoding before ending the response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
chunk- the string to write before ending the responseenc- the encoding to use- See Also:
-
HttpServerResponse.end(String, String)
-
endAndForget
Same asend(Buffer)but writes a String with the specified encoding before ending the response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
chunk- the string to write before ending the responseenc- the encoding to use- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.end(String, String)
-
end
Same asend()but writes some data to the response body before ending. If the response is not chunked and no other data has been written then the @code{Content-Length} header will be automatically set.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Specified by:
endin interfaceWriteStream<io.vertx.core.buffer.Buffer>- Parameters:
chunk- the buffer to write before ending the response- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.end(Buffer)
-
endAndAwait
public void endAndAwait(io.vertx.core.buffer.Buffer chunk) Same asend()but writes some data to the response body before ending. If the response is not chunked and no other data has been written then the @code{Content-Length} header will be automatically set.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
chunk- the buffer to write before ending the response- See Also:
-
HttpServerResponse.end(Buffer)
-
endAndForget
Same asend()but writes some data to the response body before ending. If the response is not chunked and no other data has been written then the @code{Content-Length} header will be automatically set.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
chunk- the buffer to write before ending the response- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.end(Buffer)
-
end
Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.Once the response has ended, it cannot be used any more.
This is a terminal action, like
sendFile(String)andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Specified by:
endin interfaceWriteStream<io.vertx.core.buffer.Buffer>- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.end()
-
endAndAwait
public void endAndAwait()Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.Once the response has ended, it cannot be used any more.
This is a terminal action, like
sendFile(String)andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.end()
-
endAndForget
Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.Once the response has ended, it cannot be used any more.
This is a terminal action, like
sendFile(String)andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.end()
-
send
Send the request with an empty body.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.send()
-
sendAndAwait
public void sendAndAwait()Send the request with an empty body.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.send()
-
sendAndForget
Send the request with an empty body.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.send()
-
send
Send the request with a stringbody.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.send(String)
-
sendAndAwait
Send the request with a stringbody.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.send(String)
-
sendAndForget
Send the request with a stringbody.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.send(String)
-
send
Send the request with a bufferbody.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.send(Buffer)
-
sendAndAwait
public void sendAndAwait(io.vertx.core.buffer.Buffer body) Send the request with a bufferbody.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.send(Buffer)
-
sendAndForget
Send the request with a bufferbody.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.send(Buffer)
-
send
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> send(ReadStream<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
sendAndAwait
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
sendAndForget
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
send
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> send(Flow.Publisher<io.vertx.core.buffer.Buffer> body) Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
sendAndAwait
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
sendAndForget
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
io.vertx.core.http.HttpServerResponse#send(ReadStream)
-
sendFile
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(String)
-
sendFileAndAwait
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpServerResponse.sendFile(String)
-
sendFileAndForget
Send the request with a streambody.If the
HttpHeaders.CONTENT_LENGTHis set then the request assumes this is the length of the {stream}, otherwise the request will set a chunkedHttpHeaders.CONTENT_ENCODING.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(String)
-
sendFile
Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
filename- path to the file to serveoffset- offset to start serving from- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(String, long)
-
sendFileAndAwait
Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
filename- path to the file to serveoffset- offset to start serving from- See Also:
-
HttpServerResponse.sendFile(String, long)
-
sendFileAndForget
Same assendFile(String, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
filename- path to the file to serveoffset- offset to start serving from- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(String, long)
-
sendFile
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> sendFile(String filename, long offset, long length) Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned.
This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
filename- path to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(String, long, long)
-
sendFileAndAwait
Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned.
This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
filename- path to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- See Also:
-
HttpServerResponse.sendFile(String, long, long)
-
sendFileAndForget
Ask the OS to stream a file as specified byfilenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned.
This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
filename- path to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(String, long, long)
-
sendFile
Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
channel- the file channel to the file to serve- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(FileChannel)
-
sendFileAndAwait
Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
channel- the file channel to the file to serve- See Also:
-
HttpServerResponse.sendFile(FileChannel)
-
sendFileAndForget
Same assendFile(FileChannel, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
channel- the file channel to the file to serve- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(FileChannel)
-
sendFile
Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving from- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(FileChannel, long)
-
sendFileAndAwait
Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving from- See Also:
-
HttpServerResponse.sendFile(FileChannel, long)
-
sendFileAndForget
Same assendFile(FileChannel, long, long)using length @code{Long.MAX_VALUE} which means until the end of the file.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving from- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(FileChannel, long)
-
sendFile
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> sendFile(FileChannel channel, long offset, long length) Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system). Contrary tosendFile(String, long, long), the caller is responsible to closechannelwhen no more needed. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned. The developer is responsible to set the adequate Content-Type with
putHeader(String, String). If not application/octet-stream will be set as default Content-Type.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(FileChannel, long, long)
-
sendFileAndAwait
Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system). Contrary tosendFile(String, long, long), the caller is responsible to closechannelwhen no more needed. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned. The developer is responsible to set the adequate Content-Type with
putHeader(String, String). If not application/octet-stream will be set as default Content-Type.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- See Also:
-
HttpServerResponse.sendFile(FileChannel, long, long)
-
sendFileAndForget
Ask the OS to stream a file as specified bychanneldirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system). Contrary tosendFile(String, long, long), the caller is responsible to closechannelwhen no more needed. This is a very efficient way to serve files.The actual serve is asynchronous and may not complete until some time after this method has returned. The developer is responsible to set the adequate Content-Type with
putHeader(String, String). If not application/octet-stream will be set as default Content-Type.This is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
channel- the file channel to the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(FileChannel, long, long)
-
sendFile
Same assendFile(FileChannel)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
file- the file to serve- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(RandomAccessFile)
-
sendFileAndAwait
Same assendFile(FileChannel)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
file- the file to serve- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile)
-
sendFileAndForget
Same assendFile(FileChannel)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
file- the file to serve- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile)
-
sendFile
Same assendFile(FileChannel, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
file- the file to serveoffset- offset to start serving from- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long)
-
sendFileAndAwait
Same assendFile(FileChannel, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
file- the file to serveoffset- offset to start serving from- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long)
-
sendFileAndForget
Same assendFile(FileChannel, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
file- the file to serveoffset- offset to start serving from- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long)
-
sendFile
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> sendFile(RandomAccessFile file, long offset, long length) Same assendFile(FileChannel, long, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
file- the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long, long)
-
sendFileAndAwait
Same assendFile(FileChannel, long, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
file- the file to serveoffset- offset to start serving fromlength- the number of bytes to send- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long, long)
-
sendFileAndForget
Same assendFile(FileChannel, long, long)withRandomAccessFileThis is a terminal action, like
end()andreset(), so you can only call one of the three methods as the last step in dealing with your response.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
file- the file to serveoffset- offset to start serving fromlength- the number of bytes to send- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.sendFile(RandomAccessFile, long, long)
-
push
@CheckReturnValue public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String)
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.Unlike the bare Vert.x variant, this method returns a
HttpServerResponse. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String)
-
pushAndForget
public HttpServerResponse pushAndForget(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with no headers.Unlike the bare Vert.x variant, this method ignores the
HttpServerResponseresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String)
-
push
@CheckReturnValue public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String path, io.vertx.core.MultiMap headers) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.push(HttpMethod, String, MultiMap)
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, String path, io.vertx.core.MultiMap headers) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
HttpServerResponse. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
HttpServerResponse.push(HttpMethod, String, MultiMap)
-
pushAndForget
public HttpServerResponse pushAndForget(io.vertx.core.http.HttpMethod method, String path, io.vertx.core.MultiMap headers) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method ignores the
HttpServerResponseresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.push(HttpMethod, String, MultiMap)
-
push
@CheckReturnValue public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, String path) Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.push(HttpMethod, String)
-
pushAndAwait
Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method returns a
HttpServerResponse. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
HttpServerResponse.push(HttpMethod, String)
-
pushAndForget
Likepush(HttpMethod, HostAndPort, String, MultiMap)with the host copied from the current request.Unlike the bare Vert.x variant, this method ignores the
HttpServerResponseresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.push(HttpMethod, String)
-
push
@CheckReturnValue public io.smallrye.mutiny.Uni<HttpServerResponse> push(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
method- the method of the promised requestauthority- the authority of the promised requestpath- the path of the promised requestheaders- the headers of the promised request- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String, MultiMap)
-
pushAndAwait
public HttpServerResponse pushAndAwait(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.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
HttpServerResponse. This method awaits indefinitely 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 aRuntimeException).- Parameters:
method- the method of the promised requestauthority- the authority of the promised requestpath- the path of the promised requestheaders- the headers of the promised request- Returns:
- The operation result
- See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String, MultiMap)
-
pushAndForget
public HttpServerResponse pushAndForget(io.vertx.core.http.HttpMethod method, io.vertx.core.net.HostAndPort authority, String path, io.vertx.core.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 ignores the
HttpServerResponseresult or any failure.- Parameters:
method- the method of the promised requestauthority- the authority of the promised requestpath- the path of the promised requestheaders- the headers of the promised request- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.push(HttpMethod, HostAndPort, String, MultiMap)
-
reset
Equivalent to callingreset(long)with0.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
reset(long)HttpServerResponse.reset()
-
resetAndAwait
public void resetAndAwait()Equivalent to callingreset(long)with0.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
reset(long)HttpServerResponse.reset()
-
resetAndForget
Equivalent to callingreset(long)with0.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
reset(long)HttpServerResponse.reset()
-
reset
Reset this response:- for HTTP/2, send an HTTP/2 reset frame with the specified error
code - for HTTP/1.x, close the connection when the current response has not yet been sent
falseis returned as indicator.This is a terminal action, like
end()andsendFile(String), so you can only call one of the three methods as the last step in dealing with your response.Stream reset should be avoided because the implementation works partially for HTTP/3 and reset error codes depends on the version of the protocol,
cancel()should be used instead.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
code- the error code- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.reset(long)
- for HTTP/2, send an HTTP/2 reset frame with the specified error
-
resetAndAwait
public void resetAndAwait(long code) Reset this response:- for HTTP/2, send an HTTP/2 reset frame with the specified error
code - for HTTP/1.x, close the connection when the current response has not yet been sent
falseis returned as indicator.This is a terminal action, like
end()andsendFile(String), so you can only call one of the three methods as the last step in dealing with your response.Stream reset should be avoided because the implementation works partially for HTTP/3 and reset error codes depends on the version of the protocol,
cancel()should be used instead.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
code- the error code- See Also:
-
HttpServerResponse.reset(long)
- for HTTP/2, send an HTTP/2 reset frame with the specified error
-
resetAndForget
Reset this response:- for HTTP/2, send an HTTP/2 reset frame with the specified error
code - for HTTP/1.x, close the connection when the current response has not yet been sent
falseis returned as indicator.This is a terminal action, like
end()andsendFile(String), so you can only call one of the three methods as the last step in dealing with your response.Stream reset should be avoided because the implementation works partially for HTTP/3 and reset error codes depends on the version of the protocol,
cancel()should be used instead.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
code- the error code- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.reset(long)
- for HTTP/2, send an HTTP/2 reset frame with the specified error
-
cancel
Attempt to cancel the request according to the semantics of the underlying HTTP implementation.- for HTTP/1.x, this closes the connection when the current request is inflight
- for HTTP/2, this performs send an HTTP/2 reset frame with the error
0x08 - for HTTP/3, this resets or abort reading the underlying QUIC stream with code
0x10c
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.cancel()
-
cancelAndAwait
Attempt to cancel the request according to the semantics of the underlying HTTP implementation.- for HTTP/1.x, this closes the connection when the current request is inflight
- for HTTP/2, this performs send an HTTP/2 reset frame with the error
0x08 - for HTTP/3, this resets or abort reading the underlying QUIC stream with code
0x10c
Unlike the bare Vert.x variant, this method returns a
Boolean. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
HttpServerResponse.cancel()
-
cancelAndForget
Attempt to cancel the request according to the semantics of the underlying HTTP implementation.- for HTTP/1.x, this closes the connection when the current request is inflight
- for HTTP/2, this performs send an HTTP/2 reset frame with the error
0x08 - for HTTP/3, this resets or abort reading the underlying QUIC stream with code
0x10c
Unlike the bare Vert.x variant, this method ignores the
Booleanresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.cancel()
-
writeCustomFrame
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeCustomFrame(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.The frame is sent immediatly and is not subject to flow control.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
type- the 8-bit frame typeflags- the 8-bit frame flagspayload- the frame payload- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeCustomFrame(int, int, Buffer)
-
writeCustomFrameAndAwait
public void writeCustomFrameAndAwait(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.The frame is sent immediatly and is not subject to flow control.
Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
type- the 8-bit frame typeflags- the 8-bit frame flagspayload- the frame payload- See Also:
-
HttpServerResponse.writeCustomFrame(int, int, Buffer)
-
writeCustomFrameAndForget
public HttpServerResponse writeCustomFrameAndForget(int type, int flags, io.vertx.core.buffer.Buffer payload) Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.The frame is sent immediatly and is not subject to flow control.
Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
type- the 8-bit frame typeflags- the 8-bit frame flagspayload- the frame payload- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeCustomFrame(int, int, Buffer)
-
writeCustomFrame
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeCustomFrame(io.vertx.core.http.HttpFrame frame) LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
frame- the frame to write- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeCustomFrame(HttpFrame)
-
writeCustomFrameAndAwait
public void writeCustomFrameAndAwait(io.vertx.core.http.HttpFrame frame) LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
frame- the frame to write- See Also:
-
HttpServerResponse.writeCustomFrame(HttpFrame)
-
writeCustomFrameAndForget
LikewriteCustomFrame(int, int, Buffer)but with anHttpFrame.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
frame- the frame to write- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeCustomFrame(HttpFrame)
-
writeAltSvc
Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.
For HTTP/1.x this sets an
HttpHeaders.ALT_SVCheader, otherwise it writes a custom frame.Example usage:
response.writeAltSvc("h3=\":443\"")Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
advertisement- the advertisement- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.writeAltSvc(String)
-
writeAltSvcAndAwait
Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.
For HTTP/1.x this sets an
HttpHeaders.ALT_SVCheader, otherwise it writes a custom frame.Example usage:
response.writeAltSvc("h3=\":443\"")Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
advertisement- the advertisement- See Also:
-
HttpServerResponse.writeAltSvc(String)
-
writeAltSvcAndForget
Write an <a href="https://datatracker.ietf.org/doc/html/rfc7838"HTTP Alternative Services advertisement for the given request and its authority, according to the underlying protocol.
For HTTP/1.x this sets an
HttpHeaders.ALT_SVCheader, otherwise it writes a custom frame.Example usage:
response.writeAltSvc("h3=\":443\"")Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
advertisement- the advertisement- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.writeAltSvc(String)
-
write
Write some data to the stream.The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the
writeQueueFull()method before writing. This is done automatically if using aPipe.When the
datais moved from the queue to the actual medium, the returnedFuturewill be completed with the write result, e.g the uni is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Specified by:
writein interfaceWriteStream<io.vertx.core.buffer.Buffer>- Parameters:
data- the data to write- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpServerResponse.write(T)
-
writeAndAwait
public void writeAndAwait(io.vertx.core.buffer.Buffer arg0) Write some data to the stream.The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the
writeQueueFull()method before writing. This is done automatically if using aPipe.When the
datais moved from the queue to the actual medium, the returnedFuturewill be completed with the write result, e.g the underlying uni is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
data- the data to write- See Also:
-
HttpServerResponse.write(T)
-
writeAndForget
Write some data to the stream.The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the
writeQueueFull()method before writing. This is done automatically if using aPipe.When the
datais moved from the queue to the actual medium, the returnedFuturewill be completed with the write result, e.g the underlying uni is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
data- the data to write- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpServerResponse.write(T)
-
exceptionHandler
Description copied from interface:WriteStreamSet an exception handler on the write stream.- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWriteStream<io.vertx.core.buffer.Buffer>- Parameters:
handler- the exception handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
setWriteQueueMaxSize
Description copied from interface:WriteStreamSet the maximum size of the write queue tomaxSize. You will still be able to write to the stream even if there is more thanmaxSizeitems in the write queue. This is used as an indicator by classes such asPipeto provide flow control. The value is defined by the implementation of the stream, e.g in bytes for aNetSocket, etc...- Specified by:
setWriteQueueMaxSizein interfaceWriteStream<io.vertx.core.buffer.Buffer>- Parameters:
maxSize- the max size of the write stream- Returns:
- a reference to this, so the API can be used fluently
-
drainHandler
Description copied from interface:WriteStreamSet a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. SeePipefor an example of this being used.The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to
maxSize / 2.- Specified by:
drainHandlerin interfaceWriteStream<io.vertx.core.buffer.Buffer>- Parameters:
handler- the handler. Can benull.- 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
Set the status code. If the status message hasn't been explicitly set, a default status message corresponding to the code will be looked-up and used.- Returns:
- a reference to this, so the API can be used fluently
-
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
Set the status message- Returns:
- a reference to this, so the API can be used fluently
-
setChunked
Ifchunkedistrue, this response will use HTTP chunked encoding, and each call to write to the body will correspond to a new HTTP chunk sent on the wire.If chunked encoding is used the HTTP header
Transfer-Encodingwith a value ofChunkedwill be automatically inserted in the response.If
chunkedisfalse, this response will not use HTTP chunked encoding, and therefore the total size of any data that is written in the respone body must be set in theContent-Lengthheader before any data is written out.An HTTP chunked response is typically used when you do not know the total size of the request body up front.
- Returns:
- a reference to this, so the API can be used fluently
-
isChunked
public boolean isChunked()- Returns:
- is the response chunked?
-
headers
public io.vertx.core.MultiMap headers()- Returns:
- The HTTP headers
-
putHeader
Put an HTTP header- Parameters:
name- the header namevalue- the header value.- Returns:
- a reference to this, so the API can be used fluently
-
putHeader
LikeputHeader(String, String)but using CharSequence -
putHeader
LikeputHeader(String, String)but providing multiple values via a String Iterable -
putHeader
LikeputHeader(String, Iterable)but with CharSequence Iterable -
trailers
public io.vertx.core.MultiMap trailers()- Returns:
- The HTTP trailers
-
putTrailer
Put an HTTP trailer- Parameters:
name- the trailer namevalue- the trailer value- Returns:
- a reference to this, so the API can be used fluently
-
putTrailer
LikeputTrailer(String, String)but using CharSequence -
putTrailer
LikeputTrailer(String, String)but providing multiple values via a String Iterable -
putTrailer
LikeputTrailer(String, Iterable)but with CharSequence Iterable -
closeHandler
Set a close handler for the response, this is called when the underlying connection is closed and the response was still using the connection.For HTTP/1.x it is called when the connection is closed before
end()is called, therefore it is not guaranteed to be called.For HTTP/2 it is called when the related stream is closed, and therefore it will be always be called.
- Parameters:
handler- the handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
Set an end handler for the response. This will be called when the response is disposed to allow consistent cleanup of the response.- Parameters:
handler- the handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
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
Provide a handler that will be called just before the headers are written to the wire.This provides a hook allowing you to add any more headers or do any more operations before this occurs.
- Parameters:
handler- the handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
bodyEndHandler
Provides a handler that will be called after the last part of the body is written to the wire. The handler is called asynchronously of when the response has been received by the client. This provides a hook allowing you to do more operations once the request has been sent over the wire such as resource cleanup.- Parameters:
handler- the handler. Can benull.- 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 long streamId()- Returns:
- the id of the stream of this response, -1 for HTTP/1.x
-
setStreamPriority
Sets the priority of the associated stream This is not implemented for HTTP/1.x.- Parameters:
streamPriority- the priority for this request's stream
-
addCookie
Add a cookie. This will be sent back to the client in the response.- Parameters:
cookie- the cookie- Returns:
- a reference to this, so the API can be used fluently
-
removeCookie
Expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: This method will only remove the first occurrence of the given name. Users probably may want to use:removeCookies(String)- Parameters:
name- the name of the cookie- Returns:
- the cookie, if it existed, or null
-
removeCookie
Remove a cookie from the cookie set. If invalidate istruethen it will expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: This method will only expire the first occurrence of the given name. Users probably may want to use:removeCookies(String,boolean)- Parameters:
name- the name of the cookie- Returns:
- the cookie, if it existed, or
null
-
removeCookies
Expire all cookies, notifying a User Agent to remove it from its cookie jar. NOTE: the returnedSetis read-only. This means any attempt to modify (add or remove to the set), will throwUnsupportedOperationException.- Parameters:
name- the name of the cookie- Returns:
- a read only set of affected cookies, if they existed, or an empty set.
-
removeCookies
Remove all cookies from the cookie set. If invalidate istruethen it will expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: the returnedSetis read-only. This means any attempt to modify (add or remove to the set), will throwUnsupportedOperationException.- Parameters:
name- the name of the cookieinvalidate- invalidate from the user agent- Returns:
- a read only set of affected cookies, if they existed, or an empty set.
-
removeCookie
Expires a cookie from the cookie set. This will notify a User Agent to remove it from its cookie jar.- Parameters:
name- the name of the cookiedomain- the domain of the cookiepath- the path of the cookie- Returns:
- the cookie, if it existed, or
null
-
removeCookie
public io.vertx.core.http.Cookie removeCookie(String name, String domain, String path, boolean invalidate) Remove a cookie from the cookie set. If invalidate istruethen it will expire a cookie, notifying a User Agent to remove it from its cookie jar.- Parameters:
name- the name of the cookiedomain- the domain of the cookiepath- the path of the cookie- Returns:
- the cookie, if it existed, or
null
-
writeQueueFull
public boolean writeQueueFull()This will returntrueif there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)- Specified by:
writeQueueFullin interfaceWriteStream<io.vertx.core.buffer.Buffer>- Returns:
trueif write queue is full
-
newInstance
Creates a new instance of theHttpServerResponse. -
hashCode
public int hashCode() -
equals
-
toString
-
toSubscriber
Converts the current write stream to a subscriber.
-