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 HttpServerResponse instance via response.
It implements ReadStream so it can be used with Pump to pump data with flow control.
Anything
HttpServerRequest
Basic
Identifiable
Object
Anything
no subtypes hierarchy
Initializer |
HttpServerRequest(HttpServerRequest unknown) |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Methods | |
absoluteURI | shared default String absoluteURI() |
bodyHandler | shared default HttpServerRequest bodyHandler(Anything(Buffer)? bodyHandler) 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:
|
connection | shared default HttpConnection connection() |
customFrameHandler | shared default HttpServerRequest customFrameHandler(Anything(HttpFrame) 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. |
endHandler | shared actual default HttpServerRequest endHandler(Anything()? endHandler) Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. Refines ReadStream.endHandler |
exceptionHandler | shared actual default HttpServerRequest exceptionHandler(Anything(Throwable)? handler) Set an exception handler. Refines StreamBase.exceptionHandler |
formAttributes | shared default MultiMap formAttributes() 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. setExpectMultipart must be called first before trying to get the form attributes. |
getFormAttribute | shared default String? getFormAttribute(String attributeName) Return the first form attribute value with the specified name Parameters:
|
getHeader | shared default String? getHeader(String headerName) Return the first header value with the specified name Parameters:
|
getParam | shared default String? getParam(String paramName) Return the first param value with the specified name Parameters:
|
handler | shared actual default HttpServerRequest handler(Anything(Buffer)? handler) Set a data handler. As data is read, the handler will be called with the data. Refines ReadStream.handler |
headers | shared default MultiMap headers() |
host | shared default String? host() |
isEnded | shared default Boolean isEnded() Has the request ended? I.e. has the entire request, including the body been read? |
isExpectMultipart | shared default Boolean isExpectMultipart() |
isSSL | shared default Boolean isSSL() |
localAddress | shared default SocketAddress localAddress() |
method | shared default HttpMethod method() |
netSocket | shared default 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. |
params | shared default MultiMap params() |
path | shared default String? path() |
pause | shared actual default HttpServerRequest pause() Pause the Refines ReadStream.pause |
query | shared default String? query() |
rawMethod | shared default String rawMethod() |
remoteAddress | shared default SocketAddress remoteAddress() |
response | shared default HttpServerResponse response() |
resume | shared actual default HttpServerRequest resume() Resume reading. If the Refines ReadStream.resume |
scheme | shared default String? scheme() |
setExpectMultipart | shared default HttpServerRequest setExpectMultipart(Boolean expect) 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:
|
upgrade | shared default ServerWebSocket upgrade() 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. |
uploadHandler | shared default HttpServerRequest uploadHandler(Anything(HttpServerFileUpload)? uploadHandler) 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. |
uri | shared default String uri() |
version | shared default HttpVersion version() |
Inherited Methods |
Methods inherited from: Object equals |
Methods inherited from: ReadStream<T> |
Methods inherited from: StreamBase |