vertx-lang-scala-docs_2.12 3.7.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
- 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 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

12.  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
13.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
14.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
15.  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
16.  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
17.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
18.  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

19.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
20.  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

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

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

23.  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
24.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
25.  def headers(): MultiMap

    returns

      the headers in the request.

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

    returns

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

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

28.  def isExpectMultipart(): Boolean

    returns

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

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

    returns

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

31.  def localAddress(): SocketAddress

    returns

      the local (server side) address of the server that handles the request

32.  def method(): HttpMethod

    returns

      the HTTP method for the request.

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

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

    returns

      the query parameters in the request

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

    returns

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

39.  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
40.  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
41.  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
42.  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
43.  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
44.  def query(): Option[String]

    returns

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

45.  def rawMethod(): String

    returns

      the HTTP method as sent by the client

46.  def remoteAddress(): SocketAddress

    returns

      the remote (client side) address of the request

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

48.  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
49.  def scheme(): Option[String]

    returns

      the scheme of the request

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

51.  def streamPriority(): StreamPriority

    returns

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

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

53.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
54.  def toString(): String
    Definition Classes
      AnyRef → Any
55.  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

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

57.  def uri(): String

    returns

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

58.  def version(): HttpVersion

    returns

      the HTTP version of the request

59.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
60.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
61.  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