# 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:
  - vertx-js/http_server_request.js, line 41

### Methods

#### absoluteURI() → {string}

Source:
  - vertx-js/http_server_request.js, line 368

##### 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:
  - vertx-js/http_server_request.js, line 385

##### Returns:

Type
  HttpServerRequest

#### connection() → {HttpConnection}

Source:
  - vertx-js/http_server_request.js, line 558

##### Returns:

- the HttpConnection associated with this request
- Type
    HttpConnection

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

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:

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

Source:
  - vertx-js/http_server_request.js, line 541

##### Returns:

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

Type
  HttpServerRequest

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

##### Parameters:

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

Source:
  - vertx-js/http_server_request.js, line 113

##### Returns:

Type
  HttpServerRequest

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

##### Parameters:

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

Source:
  - vertx-js/http_server_request.js, line 53

##### 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:
  - vertx-js/http_server_request.js, line 478

##### 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:
  - vertx-js/http_server_request.js, line 495

##### 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:
  - vertx-js/http_server_request.js, line 289

##### 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:
  - vertx-js/http_server_request.js, line 320

##### Returns:

the param value

Type
  string

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

##### Parameters:

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

Source:
  - vertx-js/http_server_request.js, line 69

##### Returns:

Type
  HttpServerRequest

#### headers() → {MultiMap}

Source:
  - vertx-js/http_server_request.js, line 272

##### Returns:

- the headers in the request.
- Type
    MultiMap

#### host() → {string}

Source:
  - vertx-js/http_server_request.js, line 240

##### Returns:

- the request host. For HTTP2 it returns the pseudo header otherwise it returns the header
- Type
    string

#### isEnded() → {boolean}

Has the request ended? I.e. has the entire request, including the body been read?

Source:
  - vertx-js/http_server_request.js, line 526

##### Returns:

true if ended

Type
  boolean

#### isExpectMultipart() → {boolean}

Source:
  - vertx-js/http_server_request.js, line 441

##### Returns:

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

#### isSSL() → {boolean}

Source:
  - vertx-js/http_server_request.js, line 170

##### Returns:

- true if this NetSocket is encrypted via SSL/TLS
- Type
    boolean

#### localAddress() → {SocketAddress}

Source:
  - vertx-js/http_server_request.js, line 351

##### Returns:

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

#### method() → {Object}

Source:
  - vertx-js/http_server_request.js, line 142

##### 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:
  - vertx-js/http_server_request.js, line 408

##### Returns:

the net socket

Type
  NetSocket

#### params() → {MultiMap}

Source:
  - vertx-js/http_server_request.js, line 303

##### Returns:

- the query parameters in the request
- Type
    MultiMap

#### path() → {string}

Source:
  - vertx-js/http_server_request.js, line 212

##### Returns:

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

#### pause() → {HttpServerRequest}

Source:
  - vertx-js/http_server_request.js, line 85

##### Returns:

Type
  HttpServerRequest

#### query() → {string}

Source:
  - vertx-js/http_server_request.js, line 226

##### Returns:

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

#### rawMethod() → {string}

Source:
  - vertx-js/http_server_request.js, line 156

##### Returns:

- the HTTP method as sent by the client
- Type
    string

#### remoteAddress() → {SocketAddress}

Source:
  - vertx-js/http_server_request.js, line 334

##### Returns:

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

#### response() → {HttpServerResponse}

Source:
  - vertx-js/http_server_request.js, line 255

##### 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:
  - vertx-js/http_server_request.js, line 99

##### Returns:

Type
  HttpServerRequest

#### scheme() → {string}

Source:
  - vertx-js/http_server_request.js, line 184

##### Returns:

- the scheme of the request
- Type
    string

#### 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:
  - vertx-js/http_server_request.js, line 426

##### 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:
  - vertx-js/http_server_request.js, line 512

##### 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:
  - vertx-js/http_server_request.js, line 456

##### Returns:

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

Type
  HttpServerRequest

#### uri() → {string}

Source:
  - vertx-js/http_server_request.js, line 198

##### Returns:

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

#### version() → {Object}

Source:
  - vertx-js/http_server_request.js, line 128

##### Returns:

- the HTTP version of the request
- Type
    Object