Class HttpServerRequest
- java.lang.Object
- 
- io.vertx.reactivex.core.http.HttpRequestHead
- 
- io.vertx.reactivex.core.http.HttpServerRequest
 
 
- 
- All Implemented Interfaces:
- io.vertx.lang.rx.RxDelegate,- ReadStream<Buffer>,- StreamBase
 
 public class HttpServerRequest extends HttpRequestHead implements io.vertx.lang.rx.RxDelegate, 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 HttpServerResponseinstance viaresponse().It implements ReadStreamso it can be used withPipeto pipe data with flow control.NOTE: This class has been automatically generated from the originalnon RX-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<HttpServerRequest>__TYPE_ARG
 - 
Constructor SummaryConstructors Constructor Description HttpServerRequest(HttpServerRequest delegate)HttpServerRequest(Object delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringabsoluteURI()HostAndPortauthority()HostAndPortauthority(boolean real)Future<Buffer>body()Convenience method for receiving the entire request body in one piece.HttpServerRequestbodyHandler(Handler<Buffer> bodyHandler)Convenience method for receiving the entire request body in one piece.longbytesRead()booleancanUpgradeToWebSocket()HttpConnectionconnection()intcookieCount()Set<Cookie>cookies()Returns a modifiable set of parsed cookies from theCOOKIEheader.Set<Cookie>cookies(String name)Returns a read only set of parsed cookies that match the given name, or an empty set.HttpServerRequestcustomFrameHandler(Handler<HttpFrame> handler)Set a custom frame handler.Future<Void>end()Returns a future signaling when the request has been fully received successfully or failed.HttpServerRequestendHandler(Handler<Void> endHandler)Set an end handler.booleanequals(Object o)HttpServerRequestexceptionHandler(Handler<Throwable> handler)Set an exception handler on the read stream.HttpServerRequestfetch(long amount)Fetch the specifiedamountof elements.MultiMapformAttributes()Returns a map of all form attributes in the request.CookiegetCookie(String name)Get the cookie with the specified name.CookiegetCookie(String name, String domain, String path)Get the cookie with the specifiedHttpServerRequestgetDelegate()StringgetFormAttribute(String attributeName)Return the first form attribute value with the specified nameStringgetParam(String paramName)Return the first param value with the specified nameStringgetParam(String paramName, String defaultValue)Return the first param value with the specified name ordefaultValuewhen the query param is not presentStringgetParamsCharset()HttpServerRequesthandler(Handler<Buffer> handler)Set a data handler.inthashCode()booleanisEnded()Has the request ended?booleanisExpectMultipart()booleanisSSL()SocketAddresslocalAddress()HttpMethodmethod()static HttpServerRequestnewInstance(HttpServerRequest arg)MultiMapparams()MultiMapparams(boolean semicolonIsNormalChar)HttpServerRequestpause()Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.Pipe<Buffer>pipe()Pause this stream and return a to transfer the elements of this stream to a destination .Future<Void>pipeTo(WriteStream<Buffer> dst)Pipe thisReadStreamto theWriteStream.SocketAddressremoteAddress()HttpServerResponseresponse()HttpServerRequestresume()Resume reading, and sets the buffer inflowingmode.HttpServerRequestrouted(String route)Marks this request as being routed to the given route.Single<Buffer>rxBody()Convenience method for receiving the entire request body in one piece.CompletablerxEnd()Returns a future signaling when the request has been fully received successfully or failed.CompletablerxPipeTo(WriteStream<Buffer> dst)Pipe thisReadStreamto theWriteStream.Single<NetSocket>rxToNetSocket()Establish a TCP tunnel with the client.Single<ServerWebSocket>rxToWebSocket()Upgrade the connection of the current request to a WebSocket.Stringscheme()HttpServerRequestsetExpectMultipart(boolean expect)Call this with true if you are expecting a multi-part body to be submitted in the request.HttpServerRequestsetParamsCharset(String charset)Override the charset to use for decoding the query parameter map, when none is set,UTF8is used.SSLSessionsslSession()intstreamId()StreamPrioritystreamPriority()HttpServerRequeststreamPriorityHandler(Handler<StreamPriority> handler)Set an handler for stream priority changesFlowable<Buffer>toFlowable()Future<NetSocket>toNetSocket()Establish a TCP tunnel with the client.Observable<Buffer>toObservable()StringtoString()Future<ServerWebSocket>toWebSocket()Upgrade the connection of the current request to a WebSocket.HttpServerRequestuploadHandler(Handler<HttpServerFileUpload> uploadHandler)Set an upload handler.HttpVersionversion()- 
Methods inherited from class io.vertx.reactivex.core.http.HttpRequestHeadgetHeader, getHeader, headers, newInstance, path, query, uri
 
- 
 
- 
- 
- 
Field Detail- 
__TYPE_ARGpublic static final io.vertx.lang.rx.TypeArg<HttpServerRequest> __TYPE_ARG 
 
- 
 - 
Constructor Detail- 
HttpServerRequestpublic HttpServerRequest(HttpServerRequest delegate) 
 - 
HttpServerRequestpublic HttpServerRequest(Object delegate) 
 
- 
 - 
Method Detail- 
toStringpublic String toString() - Overrides:
- toStringin class- HttpRequestHead
 
 - 
equalspublic boolean equals(Object o) - Overrides:
- equalsin class- HttpRequestHead
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- HttpRequestHead
 
 - 
getDelegatepublic HttpServerRequest getDelegate() - Specified by:
- getDelegatein interface- ReadStream<Buffer>
- Specified by:
- getDelegatein interface- io.vertx.lang.rx.RxDelegate
- Specified by:
- getDelegatein interface- StreamBase
- Overrides:
- getDelegatein class- HttpRequestHead
 
 - 
toObservablepublic Observable<Buffer> toObservable() - Specified by:
- toObservablein interface- ReadStream<Buffer>
 
 - 
toFlowablepublic Flowable<Buffer> toFlowable() - Specified by:
- toFlowablein interface- ReadStream<Buffer>
 
 - 
pipepublic Pipe<Buffer> pipe() Pause this stream and return a to transfer the elements of this stream to a destination . The stream will be resumed when the pipe will be wired to aWriteStream.- Specified by:
- pipein interface- ReadStream<Buffer>
- Returns:
- a pipe
 
 - 
pipeTopublic Future<Void> pipeTo(WriteStream<Buffer> dst) Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails. - Specified by:
- pipeToin interface- ReadStream<Buffer>
- Parameters:
- dst- the destination write stream
- Returns:
- a future notified when the write stream will be ended with the outcome
 
 - 
rxPipeTopublic Completable rxPipeTo(WriteStream<Buffer> dst) Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails. - Specified by:
- rxPipeToin interface- ReadStream<Buffer>
- Parameters:
- dst- the destination write stream
- Returns:
- a future notified when the write stream will be ended with the outcome
 
 - 
exceptionHandlerpublic HttpServerRequest exceptionHandler(Handler<Throwable> handler) Description copied from interface:ReadStreamSet an exception handler on the read stream.- Specified by:
- exceptionHandlerin interface- ReadStream<Buffer>
- Specified by:
- exceptionHandlerin interface- StreamBase
- Parameters:
- handler- the exception handler
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
handlerpublic HttpServerRequest handler(Handler<Buffer> handler) Description copied from interface:ReadStreamSet a data handler. As data is read, the handler will be called with the data.- Specified by:
- handlerin interface- ReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
pausepublic HttpServerRequest pause() Description copied from interface:ReadStreamPause theReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data handler.- Specified by:
- pausein interface- ReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
resumepublic HttpServerRequest resume() Description copied from interface:ReadStreamResume reading, and sets the buffer inflowingmode. If theReadStreamhas been paused, reading will recommence on it.- Specified by:
- resumein interface- ReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
fetchpublic HttpServerRequest fetch(long amount) Description copied from interface:ReadStreamFetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
- fetchin interface- ReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
endHandlerpublic HttpServerRequest endHandler(Handler<Void> endHandler) Description copied from interface:ReadStreamSet an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.- Specified by:
- endHandlerin interface- ReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
versionpublic HttpVersion version() - Returns:
- the HTTP version of the request
 
 - 
methodpublic HttpMethod method() - Overrides:
- methodin class- HttpRequestHead
- Returns:
- the HTTP method for the request.
 
 - 
isSSLpublic boolean isSSL() - Returns:
- true if this NetSocketis encrypted via SSL/TLS
 
 - 
schemepublic String scheme() - Returns:
- the scheme of the request
 
 - 
authoritypublic HostAndPort authority() - Returns:
- the request authority. - HTTP/2: the pseudo header is returned if present, otherwise the header value is returned.
- HTTP/1.x: the header is returned
- or nullwhen no such header is present
 -1to indicate the scheme port is prevalent.
 
 - 
authoritypublic HostAndPort authority(boolean real) - Parameters:
- real- whether to return the value of the real HTTP/2 header, or the computed one.
- Returns:
- the authority, either computed or real. May be null when  is true.
 
 - 
bytesReadpublic long bytesRead() - Returns:
- the total number of bytes read for the body of the request.
 
 - 
responsepublic HttpServerResponse response() - Returns:
- the response. Each instance of this class has an HttpServerResponseinstance attached to it. This is used to send the response back to the client.
 
 - 
setParamsCharsetpublic HttpServerRequest setParamsCharset(String charset) Override the charset to use for decoding the query parameter map, when none is set,UTF8is used.- Parameters:
- charset- the charset to use for decoding query params
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
getParamsCharsetpublic String getParamsCharset() - Returns:
- the charset used for decoding query parameters
 
 - 
paramspublic MultiMap params() - Returns:
- the query parameters in the request
 
 - 
paramspublic MultiMap params(boolean semicolonIsNormalChar) - Parameters:
- semicolonIsNormalChar- whether semicolon is treated as a normal character or a query parameter separator
- Returns:
- the query parameters in the request
 
 - 
getParampublic String getParam(String paramName) Return the first param value with the specified name- Parameters:
- paramName- the param name
- Returns:
- the param value
 
 - 
getParampublic String getParam(String paramName, String defaultValue) Return the first param value with the specified name ordefaultValuewhen the query param is not present- Parameters:
- paramName- the param name
- defaultValue- the default value, must be non-null
- Returns:
- the param value or defaultValuewhen not present
 
 - 
remoteAddresspublic SocketAddress remoteAddress() - Returns:
- the remote address for this connection, possibly null(e.g a server bound on a domain socket). IfuseProxyProtocolis set totrue, the address returned will be of the actual connecting client.
 
 - 
localAddresspublic SocketAddress localAddress() - Returns:
- the local address for this connection, possibly null(e.g a server bound on a domain socket) IfuseProxyProtocolis set totrue, the address returned will be of the proxy.
 
 - 
absoluteURIpublic String absoluteURI() - Returns:
- the absolute URI corresponding to the HTTP request
 
 - 
bodyHandlerpublic HttpServerRequest bodyHandler(Handler<Buffer> bodyHandler) 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. - Parameters:
- bodyHandler- This handler will be called after all the body has been received
- Returns:
 
 - 
bodypublic Future<Buffer> body() Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler 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. - Returns:
- a future completed with the body result
 
 - 
rxBodypublic Single<Buffer> rxBody() Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler 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. - Returns:
- a future completed with the body result
 
 - 
endpublic Future<Void> end() Returns a future signaling when the request has been fully received successfully or failed.- Returns:
- a future completed with the body result
 
 - 
rxEndpublic Completable rxEnd() Returns a future signaling when the request has been fully received successfully or failed.- Returns:
- a future completed with the body result
 
 - 
toNetSocketpublic Future<NetSocket> toNetSocket() Establish a TCP tunnel with the client.This must be called only for CONNECTHTTP method or for HTTP connection upgrade, before any response is sent.Calling this sends a 200response for aCONNECTor a101for a connection upgrade wit nocontent-lengthheader set and then provides theNetSocketfor handling the created tunnel. Any HTTP header set on the response before calling this method will be sent.server.requestHandler(req -> { if (req.method() == HttpMethod.CONNECT) { // Send a 200 response to accept the connect NetSocket socket = req.netSocket(); socket.handler(buff -> { socket.write(buff); }); } ... });- Returns:
- a future notified with the upgraded socket
 
 - 
rxToNetSocketpublic Single<NetSocket> rxToNetSocket() Establish a TCP tunnel with the client.This must be called only for CONNECTHTTP method or for HTTP connection upgrade, before any response is sent.Calling this sends a 200response for aCONNECTor a101for a connection upgrade wit nocontent-lengthheader set and then provides theNetSocketfor handling the created tunnel. Any HTTP header set on the response before calling this method will be sent.server.requestHandler(req -> { if (req.method() == HttpMethod.CONNECT) { // Send a 200 response to accept the connect NetSocket socket = req.netSocket(); socket.handler(buff -> { socket.write(buff); }); } ... });- Returns:
- a future notified with the upgraded socket
 
 - 
setExpectMultipartpublic HttpServerRequest setExpectMultipart(boolean expect) 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- Parameters:
- expect- true - if you are expecting a multi-part body
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
isExpectMultipartpublic boolean isExpectMultipart() - Returns:
- true if we are expecting a multi-part body for this request. See setExpectMultipart(boolean).
 
 - 
uploadHandlerpublic HttpServerRequest uploadHandler(Handler<HttpServerFileUpload> uploadHandler) 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.- Parameters:
- uploadHandler-
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
formAttributespublic MultiMap formAttributes() 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. setExpectMultipart(boolean)must be called first before trying to get the form attributes.- Returns:
- the form attributes
 
 - 
getFormAttributepublic String getFormAttribute(String attributeName) Return the first form attribute value with the specified name- Parameters:
- attributeName- the attribute name
- Returns:
- the attribute value
 
 - 
streamIdpublic int streamId() - Returns:
- the id of the stream of this request, when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x
 
 - 
canUpgradeToWebSocketpublic boolean canUpgradeToWebSocket() - Returns:
- whether this request can be upgraded to a WebSocket, implying it uses HTTP/1.x and presents the correct characteristics for a proper upgrade.
 
 - 
toWebSocketpublic Future<ServerWebSocket> toWebSocket() Upgrade the connection of the current request to a WebSocket.This is an alternative way of handling WebSockets and can only be used if no WebSocket handler is set on the HttpServer, and can only be used during the upgrade request during the WebSocket handshake.Both handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer>)andendHandler(io.vertx.core.Handler<java.lang.Void>)will be set to get the full body of the request that is necessary to perform the WebSocket handshake.If you need to do an asynchronous upgrade, i.e not performed immediately in your request handler, you need to pause()the request in order to not lose HTTP events necessary to upgrade the request.- Returns:
- a future notified with the upgraded WebSocket
 
 - 
rxToWebSocketpublic Single<ServerWebSocket> rxToWebSocket() Upgrade the connection of the current request to a WebSocket.This is an alternative way of handling WebSockets and can only be used if no WebSocket handler is set on the HttpServer, and can only be used during the upgrade request during the WebSocket handshake.Both handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer>)andendHandler(io.vertx.core.Handler<java.lang.Void>)will be set to get the full body of the request that is necessary to perform the WebSocket handshake.If you need to do an asynchronous upgrade, i.e not performed immediately in your request handler, you need to pause()the request in order to not lose HTTP events necessary to upgrade the request.- Returns:
- a future notified with the upgraded WebSocket
 
 - 
isEndedpublic boolean isEnded() Has the request ended? I.e. has the entire request, including the body been read?- Returns:
- true if ended
 
 - 
customFrameHandlerpublic HttpServerRequest customFrameHandler(Handler<HttpFrame> handler) 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.- Parameters:
- handler-
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
connectionpublic HttpConnection connection() - Returns:
- the HttpConnectionassociated with this request
 
 - 
streamPrioritypublic StreamPriority streamPriority() - Returns:
- the priority of the associated HTTP/2 stream for HTTP/2 otherwise null
 
 - 
streamPriorityHandlerpublic HttpServerRequest streamPriorityHandler(Handler<StreamPriority> handler) Set an handler for stream priority changesThis is not implemented for HTTP/1.x. - Parameters:
- handler- the handler to be called when stream priority changes
- Returns:
 
 - 
getCookiepublic Cookie getCookie(String name) Get the cookie with the specified name. NOTE: this will return just the 1stCookiethat matches the given name, to get all cookies for this name see:cookies(java.lang.String)- Parameters:
- name- the cookie name
- Returns:
- the cookie or nullif not found.
 
 - 
getCookiepublic Cookie getCookie(String name, String domain, String path) Get the cookie with the specified- Parameters:
- name- the cookie name
- domain- the cookie domain
- path- the cookie path
- Returns:
- the cookie or nullif not found.
 
 - 
cookieCountpublic int cookieCount() - Returns:
- the number of cookies in the cookie jar.
 
 - 
cookiespublic Set<Cookie> cookies(String name) Returns a read only set of parsed cookies that match the given name, or an empty set. Several cookies may share the same name but have different keys. A cookie is unique by itsUnsupportedOperationException.- Parameters:
- name- the name to be matches
- Returns:
- the matching cookies or empty set
 
 - 
cookiespublic Set<Cookie> cookies() Returns a modifiable set of parsed cookies from theCOOKIEheader. Several cookies may share the same name but have different keys. A cookie is unique by its- Returns:
- a set with all cookies in the cookie jar.
 
 - 
routedpublic HttpServerRequest routed(String route) Marks this request as being routed to the given route. This is purely informational and is being provided to metrics.- Parameters:
- route- The route this request has been routed to.
- Returns:
 
 - 
sslSessionpublic SSLSession sslSession() - Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
 
 - 
newInstancepublic static HttpServerRequest newInstance(HttpServerRequest arg) 
 
- 
 
-