# Class: HttpServerRequest

## vertx-js/http_server_request~ HttpServerRequest

#### new HttpServerRequest()

  Represents a server-side HTTP request.

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

  Source:
    - http_server_request.js, line 39

### Methods

#### absoluteURI() → {string}

  Source:
    - http_server_request.js, line 310

  ##### Returns:

  - the absolute URI corresponding to the the HTTP request
  - Type
      string

#### bodyHandler(bodyHandler) → {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.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `bodyHandler` | function | This handler will be called after all the body has been received

  Source:
    - http_server_request.js, line 327

  ##### Returns:

  Type
    HttpServerRequest

#### endHandler(endHandler) → {HttpServerRequest}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `endHandler` | function |

  Source:
    - http_server_request.js, line 111

  ##### Returns:

  Type
    HttpServerRequest

#### exceptionHandler(handler) → {HttpServerRequest}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function |

  Source:
    - http_server_request.js, line 51

  ##### Returns:

  Type
    HttpServerRequest

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

  HttpServerRequest#setExpectMultipart must be called first before trying to get the form attributes.

  Source:
    - http_server_request.js, line 420

  ##### Returns:

  the form attributes
  Type
    MultiMap

#### getFormAttribute(attributeName) → {string}

  Return the first form attribute value with the specified name

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `attributeName` | string | the attribute name

  Source:
    - http_server_request.js, line 437

  ##### Returns:

  the attribute value
  Type
    string

#### getHeader(headerName) → {string}

  Return the first header value with the specified name

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `headerName` | string | the header name

  Source:
    - http_server_request.js, line 231

  ##### Returns:

  the header value
  Type
    string

#### getParam(paramName) → {string}

  Return the first param value with the specified name

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `paramName` | string | the param name

  Source:
    - http_server_request.js, line 262

  ##### Returns:

  the param value
  Type
    string

#### handler(handler) → {HttpServerRequest}

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function |

  Source:
    - http_server_request.js, line 67

  ##### Returns:

  Type
    HttpServerRequest

#### headers() → {MultiMap}

  Source:
    - http_server_request.js, line 214

  ##### Returns:

  - the headers in the request.
  - Type
      MultiMap

#### isEnded() → {boolean}

  Has the request ended? I.e. has the entire request, including the body been read?
  Source:
    - http_server_request.js, line 468

  ##### Returns:

  true if ended
  Type
    boolean

#### isExpectMultipart() → {boolean}

  Source:
    - http_server_request.js, line 383

  ##### Returns:

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

#### localAddress() → {SocketAddress}

  Source:
    - http_server_request.js, line 293

  ##### Returns:

  - the local (server side) address of the server that handles the request
  - Type
      SocketAddress

#### method() → {Object}

  Source:
    - http_server_request.js, line 140

  ##### Returns:

  - the HTTP method for the request.
  - Type
      Object

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

  Source:
    - http_server_request.js, line 350

  ##### Returns:

  the net socket
  Type
    NetSocket

#### params() → {MultiMap}

  Source:
    - http_server_request.js, line 245

  ##### Returns:

  - the query parameters in the request
  - Type
      MultiMap

#### path() → {string}

  Source:
    - http_server_request.js, line 168

  ##### Returns:

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

#### pause() → {HttpServerRequest}

  Source:
    - http_server_request.js, line 83

  ##### Returns:

  Type
    HttpServerRequest

#### query() → {string}

  Source:
    - http_server_request.js, line 182

  ##### Returns:

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

#### remoteAddress() → {SocketAddress}

  Source:
    - http_server_request.js, line 276

  ##### Returns:

  - the remote (client side) address of the request
  - Type
      SocketAddress

#### response() → {HttpServerResponse}

  Source:
    - http_server_request.js, line 197

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

#### resume() → {HttpServerRequest}

  Source:
    - http_server_request.js, line 97

  ##### Returns:

  Type
    HttpServerRequest

#### setExpectMultipart(expect) → {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

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `expect` | boolean | true - if you are expecting a multi-part body

  Source:
    - http_server_request.js, line 368

  ##### Returns:

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

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

  Source:
    - http_server_request.js, line 454

  ##### Returns:

  the WebSocket
  Type
    ServerWebSocket

#### uploadHandler(uploadHandler) → {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.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `uploadHandler` | function |

  Source:
    - http_server_request.js, line 398

  ##### Returns:

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

#### uri() → {string}

  Source:
    - http_server_request.js, line 154

  ##### Returns:

  - the URI of the request. This is usually a relative URI
  - Type
      string

#### version() → {Object}

  Source:
    - http_server_request.js, line 126

  ##### Returns:

  - the HTTP version of the request
  - Type
      Object