open class HttpServerResponse : WriteStream<Buffer>
Represents a server-side HTTP response.
An instance of this is created and associated to every instance of io.vertx.rxjava.core.http.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 io.vertx.rxjava.core.streams.WriteStream so it can be used with io.vertx.rxjava.core.streams.Pump to pump data with flow control.
NOTE: This class has been automatically generated from the io.vertx.core.http.HttpServerResponse non RX-ified interface using Vert.x codegen.
HttpServerResponse(delegate: HttpServerResponse) |
static val __TYPE_ARG: TypeArg<HttpServerResponse> |
open fun bodyEndHandler(handler: Handler<Void>): HttpServerResponse
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. |
|
open fun bytesWritten(): Long |
|
open fun close(): Unit
Close the underlying TCP connection corresponding to the request. |
|
open fun closeHandler(handler: Handler<Void>): HttpServerResponse
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 For HTTP/2 it is called when the related stream is closed, and therefore it will be always be called. |
|
open fun closed(): Boolean |
|
open fun drainHandler(handler: Handler<Void>): HttpServerResponse |
|
open fun end(chunk: String): Unit
Same as open fun end(chunk: String, enc: String): Unit
Same as open fun end(chunk: Buffer): Unit
Same as open fun end(): Unit
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. |
|
open fun endHandler(handler: Handler<Void>): HttpServerResponse
Set an end handler for the response. This will be called when the response is disposed to allow consistent cleanup of the response. |
|
open fun ended(): Boolean |
|
open fun equals(other: Any?): Boolean |
|
open fun exceptionHandler(handler: Handler<Throwable>): HttpServerResponse |
|
open fun getDelegate(): HttpServerResponse |
|
open fun getStatusCode(): Int |
|
open fun getStatusMessage(): String |
|
open fun hashCode(): Int |
|
open fun headWritten(): Boolean |
|
open fun headers(): MultiMap |
|
open fun headersEndHandler(handler: Handler<Void>): HttpServerResponse
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. |
|
open fun isChunked(): Boolean |
|
open static fun newInstance(arg: HttpServerResponse): HttpServerResponse |
|
open fun push(method: HttpMethod, host: String, path: String, handler: Handler<AsyncResult<HttpServerResponse>>): HttpServerResponse
Like open fun push(method: HttpMethod, path: String, headers: MultiMap, handler: Handler<AsyncResult<HttpServerResponse>>): HttpServerResponseopen fun push(method: HttpMethod, path: String, handler: Handler<AsyncResult<HttpServerResponse>>): HttpServerResponse
Like open fun push(method: HttpMethod, host: String, path: String, headers: MultiMap, handler: Handler<AsyncResult<HttpServerResponse>>): HttpServerResponse
Push a response to the client. The |
|
open fun putHeader(name: String, value: String): HttpServerResponse
Put an HTTP header |
|
open fun putTrailer(name: String, value: String): HttpServerResponse
Put an HTTP trailer |
|
open fun reset(): Unit
Reset this HTTP/2 stream with the error code open fun reset(code: Long): Unit
Reset this HTTP/2 stream with the error |
|
open fun rxPush(method: HttpMethod, path: String): Single<HttpServerResponse>
Like open fun rxPush(method: HttpMethod, host: String, path: String, headers: MultiMap): Single<HttpServerResponse>
Push a response to the client. The |
|
open fun rxSendFile(filename: String): Single<Void>open fun rxSendFile(filename: String, offset: Long): Single<Void>open fun rxSendFile(filename: String, offset: Long, length: Long): Single<Void>
Like |
|
open fun sendFile(filename: String): HttpServerResponse
Same as open fun sendFile(filename: String, offset: Long): HttpServerResponse
Same as open fun sendFile(filename: String, offset: Long, length: Long): HttpServerResponse
Ask the OS to stream a file as specified by The actual serve is asynchronous and may not complete until some time after this method has returned. open fun sendFile(filename: String, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponseopen fun sendFile(filename: String, offset: Long, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponseopen fun sendFile(filename: String, offset: Long, length: Long, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponse
Like |
|
open fun setChunked(chunked: Boolean): HttpServerResponse
If If chunked encoding is used the HTTP header If An HTTP chunked response is typically used when you do not know the total size of the request body up front. |
|
open fun setStatusCode(statusCode: Int): HttpServerResponse
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. |
|
open fun setStatusMessage(statusMessage: String): HttpServerResponse
Set the status message |
|
open fun setWriteQueueMaxSize(maxSize: Int): HttpServerResponse |
|
open fun streamId(): Int |
|
open fun toString(): String |
|
open fun trailers(): MultiMap |
|
open fun write(data: Buffer): HttpServerResponseopen fun write(chunk: String, enc: String): HttpServerResponse
Write a java.lang.String to the response body, encoded using the encoding open fun write(chunk: String): HttpServerResponse
Write a java.lang.String to the response body, encoded in UTF-8. |
|
open fun writeContinue(): HttpServerResponse
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 |
|
open fun writeCustomFrame(type: Int, flags: Int, payload: Buffer): HttpServerResponse
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. open fun writeCustomFrame(frame: HttpFrame): HttpServerResponse
Like |
|
open fun writeQueueFull(): Boolean
This will return |