class HttpServerRequest extends 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.scala.core.http.HttpServerResponse instance via io.vertx.scala.core.http.HttpServerRequest#response. It implements io.vertx.scala.core.streams.ReadStream so it can be used with io.vertx.scala.core.streams.Pump to pump data with flow control.
- Alphabetic
- By Inheritance
- HttpServerRequest
- ReadStream
- StreamBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new HttpServerRequest(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
absoluteURI(): String
- returns
the absolute URI corresponding to the the HTTP request
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: AnyRef
- Definition Classes
- HttpServerRequest → ReadStream → StreamBase
-
def
bodyHandler(bodyHandler: Handler[Buffer]): HttpServerRequest
Convenience method for receiving the entire request body in one piece.
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.
- bodyHandler
This handler will be called after all the body has been received
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
connection(): HttpConnection
- returns
the HttpConnection associated with this request
-
def
customFrameHandler(handler: Handler[HttpFrame]): HttpServerRequest
Set a custom frame 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.
- returns
a reference to this, so the API can be used fluently
-
def
endHandler(endHandler: Handler[Unit]): HttpServerRequest
Set an end handler.
Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- HttpServerRequest → ReadStream
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exceptionHandler(handler: Handler[Throwable]): HttpServerRequest
Set an exception handler on the read stream.
Set an exception handler on the read stream.
- handler
the exception handler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- HttpServerRequest → ReadStream → StreamBase
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formAttributes(): MultiMap
Returns a map of all form attributes in the request.
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.scala.core.http.HttpServerRequest#setExpectMultipart must be called first before trying to get the form attributes.
- returns
the form attributes
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getFormAttribute(attributeName: String): Option[String]
Return the first form attribute value with the specified name
Return the first form attribute value with the specified name
- attributeName
the attribute name
- returns
the attribute value
-
def
getHeader(headerName: String): Option[String]
Return the first header value with the specified name
Return the first header value with the specified name
- headerName
the header name
- returns
the header value
-
def
getParam(paramName: String): Option[String]
Return the first param value with the specified name
Return the first param value with the specified name
- paramName
the param name
- returns
the param value
-
def
handler(handler: Handler[Buffer]): HttpServerRequest
Set a data handler.
Set a data handler. As data is read, the handler will be called with the data.
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- HttpServerRequest → ReadStream
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
headers(): MultiMap
- returns
the headers in the request.
-
def
host(): Option[String]
- returns
the request host. For HTTP2 it returns the
:authority
pseudo header otherwise it returns theHost
header
-
def
isEnded(): Boolean
Has the request ended? I.e.
Has the request ended? I.e. has the entire request, including the body been read?
- returns
true if ended
-
def
isExpectMultipart(): Boolean
- returns
true if we are expecting a multi-part body for this request. See #setExpectMultipart.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isSSL(): Boolean
- returns
true if this io.vertx.scala.core.net.NetSocket is encrypted via SSL/TLS
-
def
localAddress(): SocketAddress
- returns
the local (server side) address of the server that handles the request
-
def
method(): HttpMethod
- returns
the HTTP method for the request.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
netSocket(): NetSocket
Get a net socket for the underlying connection of this request.
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.
- returns
the net socket
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
params(): MultiMap
- returns
the query parameters in the request
-
def
path(): Option[String]
- returns
The path part of the uri. For example /somepath/somemorepath/someresource.foo
-
def
pause(): HttpServerRequest
Pause the
ReadSupport
.Pause the
ReadSupport
. While it's paused, no data will be sent to thedataHandler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- HttpServerRequest → ReadStream
-
def
query(): Option[String]
- returns
the query part of the uri. For example someparam=32&someotherparam=x
-
def
rawMethod(): String
- returns
the HTTP method as sent by the client
-
def
remoteAddress(): SocketAddress
- returns
the remote (client side) address of the request
-
def
response(): HttpServerResponse
- returns
the response. Each instance of this class has an HttpServerResponse instance attached to it. This is used to send the response back to the client.
-
def
resume(): HttpServerRequest
Resume reading.
Resume reading. If the
ReadSupport
has been paused, reading will recommence on it.- returns
a reference to this, so the API can be used fluently
- Definition Classes
- HttpServerRequest → ReadStream
-
def
scheme(): Option[String]
- returns
the scheme of the request
-
def
setExpectMultipart(expect: Boolean): HttpServerRequest
Call this with true if you are expecting a multi-part body to be submitted in the request.
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
- expect
true - if you are expecting a multi-part body
- returns
a reference to this, so the API can be used fluently
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
upgrade(): ServerWebSocket
Upgrade the connection to a WebSocket connection.
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.
- returns
the WebSocket
-
def
uploadHandler(uploadHandler: Handler[HttpServerFileUpload]): HttpServerRequest
Set an upload handler.
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.
- returns
a reference to this, so the API can be used fluently
-
def
uri(): String
- returns
the URI of the request. This is usually a relative URI
-
def
version(): HttpVersion
- returns
the HTTP version of the request
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )