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 HttpServerRequest
public HttpMethod method()
method
in interface HttpServerRequest
public String uri()
uri
in interface HttpServerRequest
public String path()
path
in interface HttpServerRequest
public String query()
query
in interface HttpServerRequest
public HttpServerResponse response()
response
in interface HttpServerRequest
HttpServerResponse
instance attached to it. This is used
to send the response back to the client.public MultiMap headers()
headers
in interface HttpServerRequest
public String getHeader(String headerName)
HttpServerRequest
getHeader
in interface HttpServerRequest
headerName
- the header namepublic MultiMap params()
params
in interface HttpServerRequest
public String getParam(String paramName)
HttpServerRequest
getParam
in interface HttpServerRequest
paramName
- the param namepublic HttpServerRequest handler(Handler<Buffer> dataHandler)
ReadStream
handler
in interface HttpServerRequest
handler
in interface ReadStream<Buffer>
public HttpServerRequest exceptionHandler(Handler<Throwable> handler)
ReadStream
exceptionHandler
in interface HttpServerRequest
exceptionHandler
in interface ReadStream<Buffer>
exceptionHandler
in interface StreamBase
handler
- the exception handlerpublic HttpServerRequest pause()
ReadStream
ReadSupport
. While it's paused, no data will be sent to the dataHandler
pause
in interface HttpServerRequest
pause
in interface ReadStream<Buffer>
public HttpServerRequest resume()
ReadStream
ReadSupport
has been paused, reading will recommence on it.resume
in interface HttpServerRequest
resume
in interface ReadStream<Buffer>
public HttpServerRequest endHandler(Handler<Void> handler)
ReadStream
endHandler
in interface HttpServerRequest
endHandler
in interface ReadStream<Buffer>
public SocketAddress remoteAddress()
remoteAddress
in interface HttpServerRequest
public String absoluteURI()
absoluteURI
in interface HttpServerRequest
public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException
peerCertificateChain
in interface HttpServerRequest
SSLPeerUnverifiedException
- SSL peer's identity has not been verified.public HttpServerRequest bodyHandler(Handler<Buffer> bodyHandler)
HttpServerRequest
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.
bodyHandler
in interface HttpServerRequest
bodyHandler
- This handler will be called after all the body has been receivedpublic NetSocket netSocket()
HttpServerRequest
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.
netSocket
in interface HttpServerRequest
public HttpServerRequest uploadHandler(Handler<HttpServerFileUpload> handler)
HttpServerRequest
uploadHandler
in interface HttpServerRequest
public MultiMap formAttributes()
HttpServerRequest
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(boolean)
must be called first before trying to get the form attributes.
formAttributes
in interface HttpServerRequest
public String getFormAttribute(String attributeName)
HttpServerRequest
getFormAttribute
in interface HttpServerRequest
attributeName
- the attribute namepublic ServerWebSocket upgrade()
HttpServerRequest
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.
upgrade
in interface HttpServerRequest
public HttpServerRequest setExpectMultipart(boolean expect)
HttpServerRequest
setExpectMultipart
in interface HttpServerRequest
expect
- true - if you are expecting a multi-part bodypublic boolean isExpectMultipart()
isExpectMultipart
in interface HttpServerRequest
HttpServerRequest.setExpectMultipart(boolean)
.public SocketAddress localAddress()
localAddress
in interface HttpServerRequest
public boolean isEnded()
HttpServerRequest
isEnded
in interface HttpServerRequest
Copyright © 2015. All Rights Reserved.