new HttpServerRequest()
Represents a server-side HTTP request.
Instances are created for each request and passed to the user via a handler.
- Source:
Methods
absoluteURI() → {string}
- Source:
Returns:
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:
Returns:
-
Type
-
HttpServerRequest
connection() → {HttpConnection}
- Source:
Returns:
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:
Returns:
a reference to this, so the API can be used fluently
-
Type
-
HttpServerRequest
endHandler(endHandler) → {HttpServerRequest}
Parameters:
Name |
Type |
Description |
endHandler |
function
|
|
- Source:
Returns:
-
Type
-
HttpServerRequest
exceptionHandler(handler) → {HttpServerRequest}
Parameters:
Name |
Type |
Description |
handler |
function
|
|
- Source:
Returns:
-
Type
-
HttpServerRequest
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:
Returns:
the form attributes
-
Type
-
MultiMap
Return the first form attribute value with the specified name
Parameters:
Name |
Type |
Description |
attributeName |
string
|
the attribute name |
- Source:
Returns:
the attribute value
-
Type
-
string
Return the first header value with the specified name
Parameters:
Name |
Type |
Description |
headerName |
string
|
the header name |
- Source:
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:
Returns:
the param value
-
Type
-
string
handler(handler) → {HttpServerRequest}
Parameters:
Name |
Type |
Description |
handler |
function
|
|
- Source:
Returns:
-
Type
-
HttpServerRequest
- Source:
Returns:
host() → {string}
- Source:
Returns:
isEnded() → {boolean}
Has the request ended? I.e. has the entire request, including the body been read?
- Source:
Returns:
true if ended
-
Type
-
boolean
isExpectMultipart() → {boolean}
- Source:
Returns:
isSSL() → {boolean}
- Source:
Returns:
localAddress() → {SocketAddress}
- Source:
Returns:
method() → {Object}
- Source:
Returns:
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:
Returns:
the net socket
-
Type
-
NetSocket
params() → {MultiMap}
- Source:
Returns:
path() → {string}
- Source:
Returns:
pause() → {HttpServerRequest}
- Source:
Returns:
-
Type
-
HttpServerRequest
query() → {string}
- Source:
Returns:
rawMethod() → {string}
- Source:
Returns:
remoteAddress() → {SocketAddress}
- Source:
Returns:
response() → {HttpServerResponse}
- Source:
Returns:
resume() → {HttpServerRequest}
- Source:
Returns:
-
Type
-
HttpServerRequest
scheme() → {string}
- Source:
Returns:
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:
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:
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:
Returns:
a reference to this, so the API can be used fluently
-
Type
-
HttpServerRequest
uri() → {string}
- Source:
Returns:
version() → {Object}
- Source:
Returns: