vertx-lang-scala-docs_2.12 3.9.1 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package http
  Definition Classes
    core
- Cookie
- GoAway
- Http2Settings
- HttpClient
- HttpClientOptions
- HttpClientRequest
- HttpClientResponse
- HttpConnection
- HttpFrame
- HttpServer
- HttpServerFileUpload
- HttpServerOptions
- HttpServerRequest
- HttpServerResponse
- RequestOptions
- ServerWebSocket
- StreamPriority
- WebSocket
- WebSocketBase
- WebSocketConnectOptions
- WebSocketFrame

c

io.vertx.scala.core.http

# HttpServerRequest 

###
Companion object HttpServerRequest

#### 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.

Linear Supertypes
ReadStream[Buffer], StreamBase, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. HttpServerRequest
2. ReadStream
3. StreamBase
4. AnyRef
5. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new HttpServerRequest(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  def absoluteURI(): String

   returns

     the absolute URI corresponding to the the HTTP request

5.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
6.  def asJava: AnyRef
   Definition Classes
     HttpServerRequest → ReadStream → StreamBase
7.  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. * @param bodyHandler This handler will be called after all the body has been received

8.  def bytesRead(): Long

   returns

     the total number of bytes read for the body of the request.

9.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
10.  def connection(): HttpConnection

    returns

      the HttpConnection associated with this request

11.  def cookieCount(): Int

    returns

      the number of cookieMap.

12.  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. * @return a reference to this, so the API can be used fluently

13.  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. * @return a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream
14.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
15.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
16.  def exceptionHandler(handler: Handler[Throwable]): HttpServerRequest

    Set an exception handler on the read stream.

    Set an exception handler on the read stream. * @param handler the exception handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream → StreamBase
17.  def fetch(amount: Long): HttpServerRequest

    Fetch the specified `amount` of elements.

    Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand. * @return a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream
18.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
19.  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. * @return the form attributes

20.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
21.  def getCookie(name: String): Option[Cookie]

    Get the cookie with the specified name.

    Get the cookie with the specified name. * @param name the cookie name

    returns

      the cookie

22.  def getFormAttribute(attributeName: String): Option[String]

    Return the first form attribute value with the specified name * @param attributeName the attribute name

    Return the first form attribute value with the specified name * @param attributeName the attribute name

    returns

      the attribute value

23.  def getHeader(headerName: String): Option[String]

    Return the first header value with the specified name * @param headerName the header name

    Return the first header value with the specified name * @param headerName the header name

    returns

      the header value

24.  def getParam(paramName: String): Option[String]

    Return the first param value with the specified name * @param paramName the param name

    Return the first param value with the specified name * @param paramName the param name

    returns

      the param value

25.  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. * @return a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream
26.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
27.  def headers(): MultiMap

    returns

      the headers in the request.

28.  def host(): Option[String]

    returns

      the request host. For HTTP2 it returns the `:authority` pseudo header otherwise it returns the `Host` header

29.  def isEnded(): Boolean

    Has the request ended? I.e.

    Has the request ended? I.e. has the entire request, including the body been read? * @return true if ended

30.  def isExpectMultipart(): Boolean

    returns

      true if we are expecting a multi-part body for this request. See #setExpectMultipart.

31.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
32.  def isSSL(): Boolean

    returns

      true if this io.vertx.scala.core.net.NetSocket is encrypted via SSL/TLS

33.  def localAddress(): SocketAddress

    returns

      the local address for this connection, possibly `null` (e.g a server bound on a domain socket)

34.  def method(): HttpMethod

    returns

      the HTTP method for the request.

35.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
36.  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.

    This method must be called before the server response is ended.

    With `CONNECT` requests, a `200` response is sent with no `content-length` header set before returning the socket.

        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);
            `);
          `
          ...
        `);

    For other HTTP/1 requests 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. USE THIS WITH CAUTION! Writing to the socket directly if you don't know what you're doing can easily break the HTTP protocol.

    With HTTP/2, a `200` response is always sent with no `content-length` header set before returning the socket like in the `CONNECT` case above.

    returns

      the net socket

37.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
38.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
39.  def params(): MultiMap

    returns

      the query parameters in the request

40.  def path(): Option[String]

    returns

      The path part of the uri. For example /somepath/somemorepath/someresource.foo

41.  def pause(): HttpServerRequest

    Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

    Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

    While it's paused, no data will be sent to the data `handler`. * @return a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream
42.  def pipe(): Pipe[Buffer]

    Pause this stream and return a to transfer the elements of this stream to a destination .

    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 a `WriteStream`. * @return a pipe

    Definition Classes
      HttpServerRequest → ReadStream
43.  def pipeTo(dst: WriteStream[Buffer], handler: Handler[AsyncResult[Unit]]): Unit

    Pipe this `ReadStream` to the `WriteStream`.

    Pipe this `ReadStream` to the `WriteStream`.

    Elements emitted by this stream will be written to the write stream until this stream ends or fails.

    Once this stream has ended or failed, the write stream will be ended and the `handler` will be called with the result. * @param dst the destination write stream

    Definition Classes
      HttpServerRequest → ReadStream
44.  def pipeTo(dst: WriteStream[Buffer]): Unit

    Like io.vertx.scala.core.streams.ReadStream#pipeTo but with no completion handler.

    Like io.vertx.scala.core.streams.ReadStream#pipeTo but with no completion handler.

    Definition Classes
      HttpServerRequest → ReadStream
45.  def pipeToFuture(dst: WriteStream[Buffer]): scala.concurrent.Future[Unit]

    Like pipeTo but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Like pipeTo but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

    Definition Classes
      HttpServerRequest → ReadStream
46.  def query(): Option[String]

    returns

      the query part of the uri. For example someparam=32&someotherparam=x

47.  def rawMethod(): String

    returns

      the HTTP method as sent by the client

48.  def remoteAddress(): SocketAddress

    returns

      the remote address for this connection, possibly `null` (e.g a server bound on a domain socket)

49.  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.

50.  def resume(): HttpServerRequest

    Resume reading, and sets the buffer in `flowing` mode.

    Resume reading, and sets the buffer in `flowing` mode.

    If the `ReadStream` has been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently

    Definition Classes
      HttpServerRequest → ReadStream
51.  def scheme(): Option[String]

    returns

      the scheme of the request

52.  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 * @param expect true - if you are expecting a multi-part body

    returns

      a reference to this, so the API can be used fluently

53.  def streamPriority(): StreamPriority

    returns

      the priority of the associated HTTP/2 stream for HTTP/2 otherwise `null`see StreamPriority

54.  def streamPriorityHandler(handler: Handler[StreamPriority]): HttpServerRequest

    Set an handler for stream priority changes

    Set an handler for stream priority changes

    This is not implemented for HTTP/1.x. * @param handler the handler to be called when stream priority changes

55.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
56.  def toString(): String
    Definition Classes
      AnyRef → Any
57.  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 handler is set on the `HttpServer`, and can only be used during the upgrade request during the WebSocket handshake. * @return the WebSocket

58.  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. * @return a reference to this, so the API can be used fluently

59.  def uri(): String

    returns

      the URI of the request. This is usually a relative URI

60.  def version(): HttpVersion

    returns

      the HTTP version of the request

61.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
62.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
63.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from ReadStream[Buffer]

### Inherited from StreamBase

### Inherited from AnyRef

### Inherited from Any

### Ungrouped