new HttpServerRequest(request)
Represents a server-side HttpServerRequest object. This object is created internally
by vert.x and passed as a parameter to a request listener. It should not be directly
created.
Parameters:
Name | Type | Description |
---|---|---|
request |
org.vertx.java.core.http.HttpServerRequest | the underlying Java HttpServerRequest object |
- Source:
Example
var http = require('vertx/http');
var console = require('vertx/console');
var server = http.createHttpServer();
server.requestHandler(function(request) {
// Get headers from the HttpServerRequest object
// and write them to the console
for (var k in request.headers()) {
console.log(k + ": " + headers[k]);
}
request.response.end(str);
}).listen(8080, 'localhost');
Extends
Members
-
response
-
- Source:
Properties:
Name Type Description response
module:vertx/http.HttpServerResponse A response object that can be used to send a response to this request.
Methods
-
absoluteURI() → {string}
-
Return the absolute URI corresponding to the the HTTP request
- Source:
Returns:
absoluteURI- Type
- string
-
bodyHandler(handler) → {module:vertx/http.HttpServerRequest}
-
Set the body handler for this request, the handler receives a single Buffer object as a parameter. This can be used as a decorator.
Parameters:
Name Type Description handler
BodyHandler The handler to call once the body was received - Source:
Returns:
this -
dataHandler(handler)
-
Set a data handler. As data is read, the handler will be called with a Buffer containing the data read.
Parameters:
Name Type Description handler
BodyHandler the handler to call - Inherited From:
- Source:
-
endHandler(handler)
-
Set an end handler. Once the stream has ended, and there is no more data to be read, the handler will be called.
Parameters:
Name Type Description handler
Handler the handler to call - Inherited From:
- Source:
-
exceptionHandler(handler)
-
Set an exception handler.
Parameters:
Name Type Description handler
Handler the handler to call - Inherited From:
- Source:
-
expectMultiPart(expect) → {module:vertx/http.HttpServerRequest}
-
Inform the server that we are expecting a multi-part form. You _must_ call this function _before_ receiving the request body if you expect it to contain a multi-part form.
Parameters:
Name Type Description expect
boolean Whether to expect a multi-part form - Source:
Returns:
this -
formAttributes() → {module:vertx/multi_map~MultiMap}
-
Return a form attributes object
- Source:
Returns:
The form attributes -
headers() → {module:vertx/multi_map~MultiMap}
-
The headers of the request.
- Source:
Returns:
-
localAddress()
-
Get the address of the server. An address object contains port and address properties.
- Source:
Returns:
the local address. -
method() → {string}
-
The HTTP method, one of HEAD, OPTIONS, GET, POST, PUT, DELETE, CONNECT, TRACE
- Source:
Returns:
The HTTP method- Type
- string
-
netSocket() → {module:vertx/net.NetSocket}
-
Get the NetSocket. Primarily for internal use, but if you really must roll your own websockets or some such, this will let you do that.
- Source:
Returns:
The rawNetSocket
. -
params() → {module:vertx/multi_map~MultiMap}
-
Return the remote (client side) address of the request
- Source:
Returns:
-
path() → {string}
-
The path part of the uri. For example /path/morepath/resource.foo
- Source:
Returns:
path- Type
- string
-
pause()
-
Pause the
ReadStream
. While the stream is paused, no data will be sent to the data Handler- Inherited From:
- Source:
-
peerCertificateChain() → {Array}
-
Get an array of Java X509Certificate objects
- Source:
Returns:
Array of Java X509Certificate objects- Type
- Array
-
query() → {string}
-
The query part of the uri. For example param=32&otherparam=x
- Source:
Returns:
query- Type
- string
-
remoteAddress()
-
Get the address of the remote peer. An address object contains port and address properties.
- Source:
Returns:
the remote address -
resume()
-
Resume reading. If the
ReadStream
has been paused, reading will recommence on it.- Inherited From:
- Source:
-
uploadHandler(handler) → {module:vertx/http.HttpServerRequest}
-
Set the upload handler. The handler will get notified once a new file upload was received and so allow to get notified by the upload in progress.
Parameters:
Name Type Description handler
UploadHandler The handler to call - Source:
Returns:
this -
uri() → {string}
-
The uri of the request. For example http://www.somedomain.com/path/morepath/resource.foo?param=32&otherparam=x
- Source:
Returns:
uri- Type
- string
-
version() → {string}
-
The HTTP version - either HTTP_1_0 or HTTP_1_1
- Source:
Returns:
version- Type
- string