public class HttpServerRequestImpl extends Object implements HttpServerRequest
| Modifier and Type | Method and Description |
|---|---|
String |
absoluteURI() |
HttpServerRequest |
bodyHandler(Handler<Buffer> bodyHandler)
Convenience method for receiving the entire request body in one piece.
|
HttpServerRequest |
endHandler(Handler<Void> handler)
Set an end handler.
|
HttpServerRequest |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
MultiMap |
formAttributes()
Returns a map of all form attributes in the request.
|
String |
getFormAttribute(String attributeName)
Return the first form attribute value with the specified name
|
String |
getHeader(String headerName)
Return the first header value with the specified name
|
String |
getParam(String paramName)
Return the first param value with the specified name
|
HttpServerRequest |
handler(Handler<Buffer> dataHandler)
Set a data handler.
|
MultiMap |
headers() |
boolean |
isEnded()
Has the request ended? I.e.
|
boolean |
isExpectMultipart() |
SocketAddress |
localAddress() |
HttpMethod |
method() |
NetSocket |
netSocket()
Get a net socket for the underlying connection of this request.
|
MultiMap |
params() |
String |
path() |
HttpServerRequest |
pause()
Pause the
ReadSupport. |
X509Certificate[] |
peerCertificateChain() |
String |
query() |
SocketAddress |
remoteAddress() |
HttpServerResponse |
response() |
HttpServerRequest |
resume()
Resume reading.
|
HttpServerRequest |
setExpectMultipart(boolean expect)
Call this with true if you are expecting a multi-part body to be submitted in the request.
|
ServerWebSocket |
upgrade()
Upgrade the connection to a WebSocket connection.
|
HttpServerRequest |
uploadHandler(Handler<HttpServerFileUpload> handler)
Set an upload handler.
|
String |
uri() |
HttpVersion |
version() |
public HttpVersion version()
version in interface HttpServerRequestpublic HttpMethod method()
method in interface HttpServerRequestpublic String uri()
uri in interface HttpServerRequestpublic String path()
path in interface HttpServerRequestpublic String query()
query in interface HttpServerRequestpublic HttpServerResponse response()
response in interface HttpServerRequestHttpServerResponse instance attached to it. This is used
to send the response back to the client.public MultiMap headers()
headers in interface HttpServerRequestpublic String getHeader(String headerName)
HttpServerRequestgetHeader in interface HttpServerRequestheaderName - the header namepublic MultiMap params()
params in interface HttpServerRequestpublic String getParam(String paramName)
HttpServerRequestgetParam in interface HttpServerRequestparamName - the param namepublic HttpServerRequest handler(Handler<Buffer> dataHandler)
ReadStreamhandler in interface HttpServerRequesthandler in interface ReadStream<Buffer>public HttpServerRequest exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface HttpServerRequestexceptionHandler in interface ReadStream<Buffer>exceptionHandler in interface StreamBasehandler - the exception handlerpublic HttpServerRequest pause()
ReadStreamReadSupport. While it's paused, no data will be sent to the dataHandlerpause in interface HttpServerRequestpause in interface ReadStream<Buffer>public HttpServerRequest resume()
ReadStreamReadSupport has been paused, reading will recommence on it.resume in interface HttpServerRequestresume in interface ReadStream<Buffer>public HttpServerRequest endHandler(Handler<Void> handler)
ReadStreamendHandler in interface HttpServerRequestendHandler in interface ReadStream<Buffer>public SocketAddress remoteAddress()
remoteAddress in interface HttpServerRequestpublic String absoluteURI()
absoluteURI in interface HttpServerRequestpublic X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException
peerCertificateChain in interface HttpServerRequestSSLPeerUnverifiedException - SSL peer's identity has not been verified.public HttpServerRequest bodyHandler(Handler<Buffer> bodyHandler)
HttpServerRequestThis 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.
bodyHandler in interface HttpServerRequestbodyHandler - This handler will be called after all the body has been receivedpublic NetSocket netSocket()
HttpServerRequestUSE 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.
netSocket in interface HttpServerRequestpublic HttpServerRequest uploadHandler(Handler<HttpServerFileUpload> handler)
HttpServerRequestuploadHandler in interface HttpServerRequestpublic MultiMap formAttributes()
HttpServerRequestBe 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(boolean) must be called first before trying to get the form attributes.
formAttributes in interface HttpServerRequestpublic String getFormAttribute(String attributeName)
HttpServerRequestgetFormAttribute in interface HttpServerRequestattributeName - the attribute namepublic ServerWebSocket upgrade()
HttpServerRequestThis 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.
upgrade in interface HttpServerRequestpublic HttpServerRequest setExpectMultipart(boolean expect)
HttpServerRequestsetExpectMultipart in interface HttpServerRequestexpect - true - if you are expecting a multi-part bodypublic boolean isExpectMultipart()
isExpectMultipart in interface HttpServerRequestHttpServerRequest.setExpectMultipart(boolean).public SocketAddress localAddress()
localAddress in interface HttpServerRequestpublic boolean isEnded()
HttpServerRequestisEnded in interface HttpServerRequestCopyright © 2015. All Rights Reserved.