vertx / io.vertx.reactivex.core.http / HttpServerRequest

HttpServerRequest

open class HttpServerRequest : ReadStream<Buffer>

Represents a server-side HTTP request.

Instances are created for each request and passed to the user via a handler.

Each instance of this class is associated with a corresponding io.vertx.reactivex.core.http.HttpServerResponse instance via io.vertx.reactivex.core.http.HttpServerRequest#response.

It implements io.vertx.reactivex.core.streams.ReadStream so it can be used with io.vertx.reactivex.core.streams.Pump to pump data with flow control.

NOTE: This class has been automatically generated from the io.vertx.core.http.HttpServerRequest non RX-ified interface using Vert.x codegen.

Constructors

<init>

HttpServerRequest(delegate: HttpServerRequest)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<HttpServerRequest>

Functions

absoluteURI

open fun absoluteURI(): String

bodyHandler

open fun bodyHandler(bodyHandler: Handler<Buffer>): HttpServerRequest

Convenience method for receiving the entire request body in one piece.

This saves the user having to manually setting a data and end handler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.

connection

open fun connection(): HttpConnection

customFrameHandler

open fun customFrameHandler(handler: Handler<HttpFrame>): HttpServerRequest

Set a custom frame handler. The handler will get notified when the http stream receives an custom HTTP/2 frame. HTTP/2 permits extension of the protocol.

endHandler

open fun endHandler(endHandler: Handler<Void>): HttpServerRequest

equals

open fun equals(other: Any?): Boolean

exceptionHandler

open fun exceptionHandler(handler: Handler<Throwable>): HttpServerRequest

formAttributes

open fun formAttributes(): MultiMap

Returns a map of all form attributes in the request.

Be aware that the attributes will only be available after the whole body has been received, i.e. after the request end handler has been called.

io.vertx.reactivex.core.http.HttpServerRequest#setExpectMultipart must be called first before trying to get the form attributes.

getDelegate

open fun getDelegate(): HttpServerRequest

getFormAttribute

open fun getFormAttribute(attributeName: String): String

Return the first form attribute value with the specified name

getHeader

open fun getHeader(headerName: String): String

Return the first header value with the specified name

getParam

open fun getParam(paramName: String): String

Return the first param value with the specified name

handler

open fun handler(handler: Handler<Buffer>): HttpServerRequest

hashCode

open fun hashCode(): Int

headers

open fun headers(): MultiMap

host

open fun host(): String

isEnded

open fun isEnded(): Boolean

Has the request ended? I.e. has the entire request, including the body been read?

isExpectMultipart

open fun isExpectMultipart(): Boolean

isSSL

open fun isSSL(): Boolean

localAddress

open fun localAddress(): SocketAddress

method

open fun method(): HttpMethod

netSocket

open fun netSocket(): NetSocket

Get a net socket for the underlying connection of this request.

USE THIS WITH CAUTION!

Once you have called this method, you must handle writing to the connection yourself using the net socket, the server request instance will no longer be usable as normal. Writing to the socket directly if you don't know what you're doing can easily break the HTTP protocol.

newInstance

open static fun newInstance(arg: HttpServerRequest): HttpServerRequest

params

open fun params(): MultiMap

path

open fun path(): String

pause

open fun pause(): HttpServerRequest

query

open fun query(): String

rawMethod

open fun rawMethod(): String

remoteAddress

open fun remoteAddress(): SocketAddress

response

open fun response(): HttpServerResponse

resume

open fun resume(): HttpServerRequest

scheme

open fun scheme(): String

setExpectMultipart

open fun setExpectMultipart(expect: Boolean): HttpServerRequest

Call this with true if you are expecting a multi-part body to be submitted in the request. This must be called before the body of the request has been received

toFlowable

open fun toFlowable(): Flowable<Buffer>

toObservable

open fun toObservable(): Observable<Buffer>

toString

open fun toString(): String

upgrade

open fun upgrade(): ServerWebSocket

Upgrade the connection to a WebSocket connection.

This is an alternative way of handling WebSockets and can only be used if no websocket handlers are set on the Http server, and can only be used during the upgrade request during the WebSocket handshake.

uploadHandler

open fun uploadHandler(uploadHandler: Handler<HttpServerFileUpload>): HttpServerRequest

Set an upload handler. The handler will get notified once a new file upload was received to allow you to deal with the file upload.

uri

open fun uri(): String

version

open fun version(): HttpVersion