Add a cookie. This will be sent back to the client in the response.
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.
Close the underlying TCP connection corresponding to the request.
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.
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#end} but with an handler
called when the operation completes
Set an end handler for the response. This will be called when the response is disposed to allow consistent cleanup of the response.
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.
Like {@link HttpServerResponse#push} with no headers.
Like {@link HttpServerResponse#push} with no headers.
Like {@link HttpServerResponse#push} with the host copied from the current request.
Like {@link HttpServerResponse#push} with the host copied from the current request.
Like {@link HttpServerResponse#push} with the host copied from the current request.
Like {@link HttpServerResponse#push} with the host copied from the current request.
Push a response to the client.
The handler
will 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.
The handler
may 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.
Push a response to the client.
The handler
will 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.
The handler
may 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.
Put an HTTP header
Like {@link HttpServerResponse#putHeader} but using CharSequence
Like {@link HttpServerResponse#putHeader} but providing multiple values via a String Iterable
Like {@link HttpServerResponse#putHeader} but with CharSequence Iterable
Put an HTTP trailer
Like {@link HttpServerResponse#putTrailer} but using CharSequence
Like {@link HttpServerResponse#putTrailer} but providing multiple values via a String Iterable
Like {@link HttpServerResponse#putTrailer} but with CharSequence Iterable
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: {@link HttpServerResponse#removeCookies}
Remove a cookie from the cookie set. If invalidate is true
then 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: {@link HttpServerResponse#removeCookies}
Expires a cookie from the cookie set. This will notify a User Agent to remove it from its cookie jar.
Remove a cookie from the cookie set. If invalidate is true
then it will expire a cookie, notifying a User
Agent to remove it from its cookie jar.
Expire all cookies, notifying a User Agent to remove it from its cookie jar.
NOTE: the returned is read-only. This means any attempt to modify (add or remove to the set), will throw UnsupportedOperationException.
Remove all cookies from the cookie set. If invalidate is true
then it will expire a cookie, notifying a
User Agent to remove it from its cookie jar.
NOTE: the returned is read-only. This means any attempt to modify (add or remove to the set), will throw UnsupportedOperationException.
Reset this HTTP/2 stream with the error code 0
.
Reset this response:
code
false
is returned as indicator.
Send the request with an empty body.
Send the request with an empty body.
Send the request with a string body
.
Send the request with a string body
.
Send the request with a buffer body
.
Send the request with a buffer body
.
Send the request with a stream body
.
If the CONTENT_LENGTH is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked CONTENT_ENCODING.
Send the request with a stream body
.
If the CONTENT_LENGTH is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked CONTENT_ENCODING.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
Like {@link HttpServerResponse#sendFile} but providing a handler which will be notified once the file has been completely written to the wire.
If chunked
is true
, 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-Encoding
with a value of Chunked
will be
automatically inserted in the response.
If chunked
is false
, 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 the Content-Length
header 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.
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.
Set the status message
Sets the priority of the associated stream
This is not implemented for HTTP/1.x.Same as but with an handler
called when the operation completes
Same as but with an handler
called when the operation completes
Same as {@link HttpServerResponse#write} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#write} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#write} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#write} but with an handler
called when the operation completes
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" header
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.
Like {@link HttpServerResponse#writeCustomFrame} but with an HttpFrame.
Same as {@link HttpServerResponse#writeEarlyHints} but with an handler
called when the operation completes
Same as {@link HttpServerResponse#writeEarlyHints} but with an handler
called when the operation completes
This will return true
if there are more bytes in the write queue than the value set using {@link HttpServerResponse#setWriteQueueMaxSize}
Generated using TypeDoc
Represents a server-side HTTP response.
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.
It implements WriteStream so it can be used with Pipe to pipe data with flow control.