The internal type of the Java wrapped class.
The internal type of the Java wrapped class.
The internal instance of the Java wrapped class.
The internal instance of the Java wrapped class.
Close the underlying TCP connection
Set a close handler for the response.
Set a close handler for the response. This will be called if the underlying connection closes before the response is complete.
callback when close has completed
Set a drain handler on the stream.
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue has been reduced to maxSize / 2. See org.vertx.scala.core.streams.Pump for an example of this being used.
Same as org.vertx.scala.core.http.HttpServerResponse.end(Buffer) but writes a String with the default encoding before ending the response.
Same as org.vertx.scala.core.http.HttpServerResponse.end(Buffer) but writes a String with the specified encoding before ending the response.
Same as org.vertx.scala.core.http.HttpServerResponse.end() but writes some data to the response body before ending.
Same as org.vertx.scala.core.http.HttpServerResponse.end() 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 Content-Length header will be automatically set
Ends the response.
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.
Set an exception handler.
Set an exception handler.
The HTTP status code of the response.
The HTTP status code of the response. The default is 200} representing
OK}.
The status code.
The HTTP status message of the response.
The HTTP status message of the response. If this is not specified a default value will be used depending on what org.vertx.scala.core.http.HttpServerResponse.setStatusCode has been set to.
The status message.
Returns the HTTP headers.
Returns the HTTP headers.
This method converts a Java collection into a Scala collection every time it gets called, so use it sensibly.
The HTTP headers.
Is the response chunked?
Put an HTTP header - fluent API.
Put an HTTP header - fluent API.
The header name
The header values.
A reference to this, so multiple method calls can be chained.
Put an HTTP trailer - fluent API.
Put an HTTP trailer - fluent API.
The trailer name
The trailer value
A reference to this, so multiple method calls can be chained.
Put an HTTP trailer - fluent API.
Put an HTTP trailer - fluent API.
The trailer name
The trailer values
A reference to this, so multiple method calls can be chained.
Same as String) but also takes a handler that will be called when the send has completed or a failure has occurred
If chunked
is true
, this response will use HTTP chunked encoding, and each call to write to the body
Same as org.vertx.scala.core.http.HttpServerResponse.sendFile(String)
but also takes a handler that will be called when the send has completed or
a failure has occurred
Tell the kernel to stream a file as specified by filename
directly
from disk to the outgoing connection, bypassing userspace altogether
(where supported by the underlying operating system.
Tell the kernel to stream a file as specified by filename
directly
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 file to send.
A reference to this for a fluent API.
Same as org.vertx.scala.core.http.HttpServerResponse.sendFile(String) but also takes the path to a resource to serve if the resource is not found.
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
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 if any data is written the
body of the response, the total size of that data must be set in the Content-Length
header before any
data is written to the response body.
An HTTP chunked response is typically used when you do not know the total size of the request body up front.
Sets the mode to chunked (true) or not (false).
A reference to this, so multiple method calls can be chained.
Set the status code.
Set the status code.
The status code.
A reference to this, so multiple method calls can be chained.
Set the status message.
Set the status message.
The status message.
A reference to this, so multiple method calls can be chained.
Set the maximum size of the write queue to maxSize
.
Set the maximum size of the write queue to maxSize
. You will still be able to write to the stream even
if there is more than maxSize
bytes in the write queue. This is used as an indicator by classes such as
Pump
to provide flow control.
Returns the HTTP trailers.
Returns the HTTP trailers.
This method converts a Java collection into a Scala collection every time it gets called, so use it sensibly.
The HTTP trailers.
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
Write a java.lang.String to the response body, encoded using the encoding enc
.
Write a java.lang.String to the response body, encoded using the encoding enc
.
The String to write.
The encoding to use.
A reference to this, so multiple method calls can be chained.
Write a java.lang.String to the response body, encoded in UTF-8.
Write a java.lang.String to the response body, encoded in UTF-8.
The String to write.
A reference to this, so multiple method calls can be chained.
Write some data to the stream.
Write some data to the stream. The data is 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 org.vertx.scala.core.streams.WriteStream.writeQueueFull() method before writing. This is done automatically if using a org.vertx.scala.core.streams.Pump.
This will return true
if there are more bytes in the write queue than the value set using
org.vertx.scala.core.streams.WriteStream.setWriteQueueMaxSize()
This will return true
if there are more bytes in the write queue than the value set using
org.vertx.scala.core.streams.WriteStream.setWriteQueueMaxSize()
Represents a server-side HTTP response.
Instances of this class are created and associated to every instance of org.vertx.scala.core.http.HttpServerRequest that is created.
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 org.vertx.scala.core.streams.WriteStream so it can be used with org.vertx.scala.core.streams.Pump to pump data with flow control.
Instances of this class are not thread-safe