public class Http1xServerRequest extends Object implements HttpServerRequestInternal, HttpRequest
| Modifier and Type | Method and Description |
|---|---|
String |
absoluteURI() |
Future<Buffer> |
body()
Convenience method for receiving the entire request body in one piece.
|
long |
bytesRead() |
HttpConnection |
connection() |
Context |
context() |
Map<String,Cookie> |
cookieMap() |
HttpServerRequest |
customFrameHandler(Handler<HttpFrame> handler)
Set a custom frame handler.
|
Future<Void> |
end()
Returns a future signaling when the request has been fully received successfully or failed.
|
HttpServerRequest |
endHandler(Handler<Void> handler)
Set an end handler.
|
HttpServerRequest |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
HttpServerRequest |
fetch(long amount)
Fetch the specified
amount of elements. |
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
|
HttpServerRequest |
handler(Handler<Buffer> handler)
Set a data handler.
|
MultiMap |
headers() |
String |
host() |
int |
id() |
boolean |
isEnded()
Has the request ended? I.e.
|
boolean |
isExpectMultipart() |
HttpMethod |
method() |
Object |
metric() |
MultiMap |
params() |
String |
path() |
HttpServerRequest |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
X509Certificate[] |
peerCertificateChain()
Note: Java SE 5+ recommends to use javax.net.ssl.SSLSession#getPeerCertificates() instead of
of javax.net.ssl.SSLSession#getPeerCertificateChain() which this method is based on.
|
String |
query() |
SocketAddress |
remoteAddress() |
Http1xServerResponse |
response() |
HttpServerRequest |
resume()
Resume reading, and sets the buffer in
flowing mode. |
HttpServerRequest |
routed(String route)
Marks this request as being routed to the given route.
|
String |
scheme() |
HttpServerRequest |
setExpectMultipart(boolean expect)
Call this with true if you are expecting a multi-part body to be submitted in the request.
|
HttpServerRequest |
streamPriorityHandler(Handler<StreamPriority> handler)
Set an handler for stream priority changes
|
Future<NetSocket> |
toNetSocket()
Like
HttpServerRequest.toNetSocket(Handler) but returns a Future of the asynchronous result |
Future<ServerWebSocket> |
toWebSocket()
Like
HttpServerRequest.toWebSocket(Handler) but returns a Future of the asynchronous result |
HttpServerRequest |
uploadHandler(Handler<HttpServerFileUpload> handler)
Set an upload handler.
|
String |
uri() |
HttpVersion |
version() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbody, bodyHandler, cookieCount, end, getCookie, getHeader, getHeader, getParam, isSSL, localAddress, sslSession, streamId, streamPriority, toNetSocket, toWebSocketpipe, pipeTo, pipeTopublic Object metric()
metric in interface HttpServerRequestInternalHttpServerMetrics.requestBegin(Object, HttpRequest) callpublic Context context()
context in interface HttpServerRequestInternalpublic int id()
id in interface HttpRequestpublic HttpVersion version()
version in interface HttpServerRequestpublic HttpMethod method()
method in interface HttpServerRequestmethod in interface HttpRequestpublic String uri()
uri in interface HttpServerRequesturi in interface HttpRequestpublic String path()
path in interface HttpServerRequestpublic String query()
query in interface HttpServerRequestpublic String host()
host in interface HttpServerRequestpublic long bytesRead()
bytesRead in interface HttpServerRequestpublic Http1xServerResponse 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 HttpServerRequestheaders in interface HttpRequestpublic MultiMap params()
params in interface HttpServerRequestpublic HttpServerRequest handler(Handler<Buffer> handler)
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()
ReadStreamReadStream, it sets the buffer in fetch mode and clears the actual demand.
While it's paused, no data will be sent to the data handler.
pause in interface HttpServerRequestpause in interface ReadStream<Buffer>public HttpServerRequest fetch(long amount)
ReadStreamamount of elements. If the ReadStream has been paused, reading will
recommence with the specified amount of items, otherwise the specified amount will
be added to the current stream demand.fetch in interface HttpServerRequestfetch in interface ReadStream<Buffer>public HttpServerRequest resume()
ReadStreamflowing mode.
If the ReadStream 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 String scheme()
scheme in interface HttpServerRequestpublic String absoluteURI()
absoluteURI in interface HttpServerRequestabsoluteURI in interface HttpRequestpublic SocketAddress remoteAddress()
remoteAddress in interface HttpServerRequestremoteAddress in interface HttpRequestnull (e.g a server bound on a domain socket).
If useProxyProtocol is set to true, the address returned will be of the actual connecting client.public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException
HttpServerRequestHttpServerRequest.sslSession() to
access that method.peerCertificateChain in interface HttpServerRequestSSLPeerUnverifiedException - SSL peer's identity has not been verified.SSLSession.getPeerCertificateChain(),
HttpServerRequest.sslSession()public Future<NetSocket> toNetSocket()
HttpServerRequestHttpServerRequest.toNetSocket(Handler) but returns a Future of the asynchronous resulttoNetSocket 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 Future<ServerWebSocket> toWebSocket()
HttpServerRequestHttpServerRequest.toWebSocket(Handler) but returns a Future of the asynchronous resulttoWebSocket 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 boolean isEnded()
HttpServerRequestisEnded in interface HttpServerRequestpublic HttpServerRequest customFrameHandler(Handler<HttpFrame> handler)
HttpServerRequestcustomFrameHandler in interface HttpServerRequestpublic HttpConnection connection()
connection in interface HttpServerRequestHttpConnection associated with this requestpublic Future<Buffer> body()
HttpServerRequestThis saves you having to manually set a dataHandler and an endHandler 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.
body in interface HttpServerRequestpublic Future<Void> end()
HttpServerRequestend in interface HttpServerRequestpublic HttpServerRequest streamPriorityHandler(Handler<StreamPriority> handler)
HttpServerRequestThis is not implemented for HTTP/1.x.
streamPriorityHandler in interface HttpServerRequesthandler - the handler to be called when stream priority changespublic Map<String,Cookie> cookieMap()
cookieMap in interface HttpServerRequestpublic HttpServerRequest routed(String route)
HttpServerRequestrouted in interface HttpServerRequestroute - The route this request has been routed to.Copyright © 2021. All rights reserved.