Top Description Fields Constructors Methods
io.vertx.core.http.impl

public Class HttpServerRequestWrapper

extends HttpServerRequestInternal
Class Inheritance
Imports
io.netty.handler.codec.DecoderResult, io.vertx.codegen.annotations.CacheReturn, .Fluent, .GenIgnore, .Nullable, io.vertx.core.AsyncResult, .Context, .Future, .Handler, .MultiMap, .Vertx, io.vertx.core.buffer.Buffer, io.vertx.core.http.Cookie, .HttpConnection, .HttpFrame, .HttpMethod, .HttpServerFileUpload, .HttpServerRequest, .HttpServerResponse, .HttpVersion, .ServerWebSocket, .StreamPriority, io.vertx.core.net.HostAndPort, .NetSocket, .SocketAddress, io.vertx.core.streams.Pipe, .WriteStream, javax.net.ssl.SSLPeerUnverifiedException, .SSLSession, javax.security.cert.X509Certificate, java.util.Map, .Set

A wrapper class that delegates all method calls to the delegate instance. Implementing HttpServerRequest or extending HttpServerRequestInternal is not encouraged however if that is necessary, implementations should favor extending this class to ensure minimum breakage when new methods are added to the interface. The delegate instance can be accessed using protected final delegate field, any implemented method can be overridden.

Field Summary

Modifier and TypeField and Description
protected final HttpServerRequestInternal

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public HostAndPort
public Future<Buffer>
body()

Implements io.vertx.core.http.HttpServerRequest.body.

Convenience method for receiving the entire request body in one piece.

public long
public HttpConnection
public Context
public Set<Cookie>
cookies(String
the name to be matches
name
)

Implements io.vertx.core.http.HttpServerRequest.cookies.

Returns a read only set of parsed cookies that match the given name, or an empty set.

public Set<Cookie>
cookies()

Implements io.vertx.core.http.HttpServerRequest.cookies.

Returns a modifiable set of parsed cookies from the COOKIE header.

public HttpServerRequest
public DecoderResult
public Future<Void>
end()

Implements io.vertx.core.http.HttpServerRequest.end.

Returns a future signaling when the request has been fully received successfully or failed.

public HttpServerRequest
public HttpServerRequest
public HttpServerRequest
fetch(long amount)

Implements io.vertx.core.http.HttpServerRequest.fetch.

Fetch the specified amount of elements.

public MultiMap
formAttributes()

Implements io.vertx.core.http.HttpServerRequest.formAttributes.

Returns a map of all form attributes in the request.

public @Nullable Cookie
getCookie(String
the cookie name
name
)

Implements io.vertx.core.http.HttpServerRequest.getCookie.

Get the cookie with the specified name.

public @Nullable Cookie
getCookie(String
the cookie name
name
,
String
the cookie domain
domain
,
String
the cookie path
path
)

Implements io.vertx.core.http.HttpServerRequest.getCookie.

Get the cookie with the specified <name, domain, path>.

public @Nullable String
getFormAttribute(String
the attribute name
attributeName
)

Implements io.vertx.core.http.HttpServerRequest.getFormAttribute.

Return the first form attribute value with the specified name

public String
public HttpServerRequest
public MultiMap
public String
public boolean
isEnded()

Implements io.vertx.core.http.HttpServerRequest.isEnded.

Has the request ended?

public boolean
public boolean
isValidAuthority()

Overrides io.vertx.core.http.impl.HttpServerRequestInternal.isValidAuthority.

This method act as authority()!= null, trying to not allocated a new object if the authority is not yet parsed.

public HttpMethod
public Object
public MultiMap
params(boolean
whether semicolon is treated as a normal character or a query parameter separator
semicolonIsNormalChar
)

Implements io.vertx.core.http.HttpServerRequest.params.

public String
public HttpServerRequest
pause()

Implements io.vertx.core.http.HttpServerRequest.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

public X509Certificate[]
peerCertificateChain()

Implements io.vertx.core.http.HttpServerRequest.peerCertificateChain.

References Deprecated X509Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

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.

public String
public HttpServerResponse
public HttpServerRequest
resume()

Implements io.vertx.core.http.HttpServerRequest.resume.

Resume reading, and sets the buffer in flowing mode.

public HttpServerRequest
routed(String
The route this request has been routed to.
route
)

Overrides default io.vertx.core.http.HttpServerRequest.routed.

Marks this request as being routed to the given route.

public String
public HttpServerRequest
setExpectMultipart(boolean
true - if you are expecting a multi-part body
expect
)

Implements io.vertx.core.http.HttpServerRequest.setExpectMultipart.

Call this with true if you are expecting a multi-part body to be submitted in the request.

public HttpServerRequest
setParamsCharset(String
the charset to use for decoding query params
charset
)

Implements io.vertx.core.http.HttpServerRequest.setParamsCharset.

Override the charset to use for decoding the query parameter map, when none is set, UTF8 is used.

public int
public StreamPriority
public HttpServerRequest
streamPriorityHandler(Handler<StreamPriority>
the handler to be called when stream priority changes
handler
)

Implements io.vertx.core.http.HttpServerRequest.streamPriorityHandler.

Set an handler for stream priority changes

This is not implemented for HTTP/1.x.

public Future<NetSocket>
toNetSocket()

Implements io.vertx.core.http.HttpServerRequest.toNetSocket.

Like toNetSocket(Handler) but returns a Future of the asynchronous result

public Future<ServerWebSocket>
toWebSocket()

Implements io.vertx.core.http.HttpServerRequest.toWebSocket.

Like toWebSocket(Handler) but returns a Future of the asynchronous result

public HttpServerRequest
public String
public HttpVersion

Field Detail

delegateback to summary
protected final HttpServerRequestInternal delegate

Constructor Detail

HttpServerRequestWrapperback to summary
public HttpServerRequestWrapper(HttpServerRequestInternal delegate)

Method Detail

absoluteURIback to summary
public String absoluteURI()

Implements io.vertx.core.http.HttpServerRequest.absoluteURI.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.absoluteURI.

the absolute URI corresponding to the HTTP request

Annotations
@Override
authorityback to summary
public HostAndPort authority()

Implements io.vertx.core.http.HttpServerRequest.authority.

Returns:HostAndPort

Doc from io.vertx.core.http.HttpServerRequest.authority.

the request authority. For HTTP/2 the :authority pseudo header is returned, for HTTP/1.x the Host header is returned or null when no such header is present. When the authority string does not carry a port, the HostAndPort#port() returns -1 to indicate the scheme port is prevalent.

Annotations
@Override
bodyback to summary
public Future<Buffer> body()

Implements io.vertx.core.http.HttpServerRequest.body.

Doc from io.vertx.core.http.HttpServerRequest.body.

Convenience method for receiving the entire request body in one piece.

This 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.

Returns:Future<Buffer>

a future completed with the body result

Annotations
@Override
bytesReadback to summary
public long bytesRead()

Implements io.vertx.core.http.HttpServerRequest.bytesRead.

Returns:long

Doc from io.vertx.core.http.HttpServerRequest.bytesRead.

the total number of bytes read for the body of the request.

Annotations
@Override
connectionback to summary
public HttpConnection connection()

Implements io.vertx.core.http.HttpServerRequest.connection.

Returns:HttpConnection

Doc from io.vertx.core.http.HttpServerRequest.connection.

the HttpConnection associated with this request

Annotations
@Override
@CacheReturn
contextback to summary
public Context context()

Implements abstract io.vertx.core.http.impl.HttpServerRequestInternal.context.

Returns:Context

Doc from io.vertx.core.http.impl.HttpServerRequestInternal.context.

the Vert.x context associated with this server request

Annotations
@Override
cookiesback to summary
public Set<Cookie> cookies(String name)

Implements io.vertx.core.http.HttpServerRequest.cookies.

Doc from io.vertx.core.http.HttpServerRequest.cookies.

Returns a read only set of parsed cookies that match the given name, or an empty set. Several cookies may share the same name but have different keys. A cookie is unique by its <name, domain, path> tuple. The set entries are references to the request original set. This means that performing property changes in the cookie objects will affect the original object too.

Note

the returned Set is read-only. This means any attempt to modify (add or remove to the set), will throw UnsupportedOperationException.

Parameters
name:String

the name to be matches

Returns:Set<Cookie>

the matching cookies or empty set

Annotations
@Override
cookiesback to summary
public Set<Cookie> cookies()

Implements io.vertx.core.http.HttpServerRequest.cookies.

Doc from io.vertx.core.http.HttpServerRequest.cookies.

Returns a modifiable set of parsed cookies from the COOKIE header. Several cookies may share the same name but have different keys. A cookie is unique by its <name, domain, path> tuple. Request cookies are directly linked to response cookies. Any modification to a cookie object in the returned set will mark the cookie to be included in the HTTP response. Removing a cookie from the set, will also mean that it will be removed from the response, regardless if it was modified or not.

Returns:Set<Cookie>

a set with all cookies in the cookie jar.

Annotations
@Override
customFrameHandlerback to summary
public HttpServerRequest customFrameHandler(Handler<HttpFrame> handler)

Implements io.vertx.core.http.HttpServerRequest.customFrameHandler.

Doc from io.vertx.core.http.HttpServerRequest.customFrameHandler.

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.

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
@Fluent
decoderResultback to summary
public DecoderResult decoderResult()

Implements io.vertx.core.http.HttpServerRequest.decoderResult.

Returns:DecoderResult

Doc from io.vertx.core.http.HttpServerRequest.decoderResult.

Netty's decoder result useful for handling invalid requests with HttpServer#invalidRequestHandler

Annotations
@Override
@GenIgnore
endback to summary
public Future<Void> end()

Implements io.vertx.core.http.HttpServerRequest.end.

Doc from io.vertx.core.http.HttpServerRequest.end.

Returns a future signaling when the request has been fully received successfully or failed.

Returns:Future<Void>

a future completed with the body result

Annotations
@Override
endHandlerback to summary
public HttpServerRequest endHandler(Handler<Void> endHandler)

Implements io.vertx.core.http.HttpServerRequest.endHandler.

Annotations
@Override
exceptionHandlerback to summary
public HttpServerRequest exceptionHandler(Handler<Throwable> handler)

Implements io.vertx.core.http.HttpServerRequest.exceptionHandler.

Annotations
@Override
fetchback to summary
public HttpServerRequest fetch(long amount)

Implements io.vertx.core.http.HttpServerRequest.fetch.

Doc from io.vertx.core.streams.ReadStream.fetch.

Fetch the specified amount 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.

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
formAttributesback to summary
public MultiMap formAttributes()

Implements io.vertx.core.http.HttpServerRequest.formAttributes.

Doc from io.vertx.core.http.HttpServerRequest.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(boolean) must be called first before trying to get the form attributes.

Returns:MultiMap

the form attributes

Annotations
@Override
@CacheReturn
getCookieback to summary
public @Nullable Cookie getCookie(String name)

Implements io.vertx.core.http.HttpServerRequest.getCookie.

Doc from io.vertx.core.http.HttpServerRequest.getCookie.

Get the cookie with the specified name.

Note

this will return just the 1st Cookie that matches the given name, to get all cookies for this name see: cookies(String)

Parameters
name:String

the cookie name

Returns:@Nullable Cookie

the cookie or null if not found.

Annotations
@Override
getCookieback to summary
public @Nullable Cookie getCookie(String name, String domain, String path)

Implements io.vertx.core.http.HttpServerRequest.getCookie.

Doc from io.vertx.core.http.HttpServerRequest.getCookie.

Get the cookie with the specified <name, domain, path>.

Parameters
name:String

the cookie name

domain:String

the cookie domain

path:String

the cookie path

Returns:@Nullable Cookie

the cookie or null if not found.

Annotations
@Override
getFormAttributeback to summary
public @Nullable String getFormAttribute(String attributeName)

Implements io.vertx.core.http.HttpServerRequest.getFormAttribute.

Doc from io.vertx.core.http.HttpServerRequest.getFormAttribute.

Return the first form attribute value with the specified name

Parameters
attributeName:String

the attribute name

Returns:@Nullable String

the attribute value

Annotations
@Override
getParamsCharsetback to summary
public String getParamsCharset()

Implements io.vertx.core.http.HttpServerRequest.getParamsCharset.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.getParamsCharset.

the charset used for decoding query parameters

Annotations
@Override
handlerback to summary
public HttpServerRequest handler(Handler<Buffer> handler)

Implements io.vertx.core.http.HttpServerRequest.handler.

Annotations
@Override
headersback to summary
public MultiMap headers()

Implements io.vertx.core.http.HttpServerRequest.headers.

Returns:MultiMap

Doc from io.vertx.core.http.HttpServerRequest.headers.

the headers in the request.

Annotations
@Override
hostback to summary
public String host()

Implements io.vertx.core.http.HttpServerRequest.host.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.host.

the request host. For HTTP2 it returns the :authority pseudo header otherwise it returns the Host header

Annotations
@Override
isEndedback to summary
public boolean isEnded()

Implements io.vertx.core.http.HttpServerRequest.isEnded.

Doc from io.vertx.core.http.HttpServerRequest.isEnded.

Has the request ended? I.e. has the entire request, including the body been read?

Returns:boolean

true if ended

Annotations
@Override
isExpectMultipartback to summary
public boolean isExpectMultipart()

Implements io.vertx.core.http.HttpServerRequest.isExpectMultipart.

Returns:boolean

Doc from io.vertx.core.http.HttpServerRequest.isExpectMultipart.

true if we are expecting a multi-part body for this request. See setExpectMultipart.

Annotations
@Override
isValidAuthorityback to summary
public boolean isValidAuthority()

Overrides io.vertx.core.http.impl.HttpServerRequestInternal.isValidAuthority.

Doc from io.vertx.core.http.impl.HttpServerRequestInternal.isValidAuthority.

This method act as authority()!= null, trying to not allocated a new object if the authority is not yet parsed.

Annotations
@Override
methodback to summary
public HttpMethod method()

Implements io.vertx.core.http.HttpServerRequest.method.

Returns:HttpMethod

Doc from io.vertx.core.http.HttpServerRequest.method.

the HTTP method for the request.

Annotations
@Override
metricback to summary
public Object metric()

Implements abstract io.vertx.core.http.impl.HttpServerRequestInternal.metric.

Returns:Object

Doc from io.vertx.core.http.impl.HttpServerRequestInternal.metric.

the metric object returned by the io.vertx.core.spi.metrics.HttpServerMetrics#requestBegin(Object, HttpRequest) call

Annotations
@Override
paramsback to summary
public MultiMap params(boolean semicolonIsNormalChar)

Implements io.vertx.core.http.HttpServerRequest.params.

Parameters
semicolonIsNormalChar:boolean

Doc from io.vertx.core.http.HttpServerRequest.params.

whether semicolon is treated as a normal character or a query parameter separator

Returns:MultiMap

Doc from io.vertx.core.http.HttpServerRequest.params.

the query parameters in the request

Annotations
@Override
pathback to summary
public String path()

Implements io.vertx.core.http.HttpServerRequest.path.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.path.

The path part of the uri. For example /somepath/somemorepath/someresource.foo

Annotations
@Override
pauseback to summary
public HttpServerRequest pause()

Implements io.vertx.core.http.HttpServerRequest.pause.

Doc from io.vertx.core.streams.ReadStream.pause.

Pause the ReadStream, 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.

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
peerCertificateChainback to summary
public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException

Implements io.vertx.core.http.HttpServerRequest.peerCertificateChain.

Doc from io.vertx.core.http.HttpServerRequest.peerCertificateChain.

References Deprecated

X509Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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. Use sslSession() to access that method.

Returns:X509Certificate[]

an ordered array of the peer certificates. Returns null if connection is not SSL.

Annotations
@Override
@GenIgnore
Exceptions
SSLPeerUnverifiedException:
SSL peer's identity has not been verified.
queryback to summary
public String query()

Implements io.vertx.core.http.HttpServerRequest.query.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.query.

the query part of the uri. For example someparam=32&someotherparam=x

Annotations
@Override
responseback to summary
public HttpServerResponse response()

Implements io.vertx.core.http.HttpServerRequest.response.

Returns:HttpServerResponse

Doc from io.vertx.core.http.HttpServerRequest.response.

the response. Each instance of this class has an HttpServerResponse instance attached to it. This is used to send the response back to the client.

Annotations
@Override
resumeback to summary
public HttpServerRequest resume()

Implements io.vertx.core.http.HttpServerRequest.resume.

Doc from io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

If the ReadStream has been paused, reading will recommence on it.

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
routedback to summary
public HttpServerRequest routed(String route)

Overrides default io.vertx.core.http.HttpServerRequest.routed.

Doc from io.vertx.core.http.HttpServerRequest.routed.

Marks this request as being routed to the given route. This is purely informational and is being provided to metrics.

Parameters
route:String

The route this request has been routed to.

Annotations
@Override
@Fluent
schemeback to summary
public String scheme()

Implements io.vertx.core.http.HttpServerRequest.scheme.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.scheme.

the scheme of the request

Annotations
@Override
setExpectMultipartback to summary
public HttpServerRequest setExpectMultipart(boolean expect)

Implements io.vertx.core.http.HttpServerRequest.setExpectMultipart.

Doc from io.vertx.core.http.HttpServerRequest.setExpectMultipart.

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
expect:boolean

true - if you are expecting a multi-part body

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
@Fluent
setParamsCharsetback to summary
public HttpServerRequest setParamsCharset(String charset)

Implements io.vertx.core.http.HttpServerRequest.setParamsCharset.

Doc from io.vertx.core.http.HttpServerRequest.setParamsCharset.

Override the charset to use for decoding the query parameter map, when none is set, UTF8 is used.

Parameters
charset:String

the charset to use for decoding query params

Returns:HttpServerRequest

a reference to this, so the API can be used fluently

Annotations
@Override
streamIdback to summary
public int streamId()

Overrides default io.vertx.core.http.HttpServerRequest.streamId.

Returns:int

Doc from io.vertx.core.http.HttpServerRequest.streamId.

the id of the stream of this request, -1 when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x

Annotations
@Override
@CacheReturn
streamPriorityback to summary
public StreamPriority streamPriority()

Overrides default io.vertx.core.http.HttpServerRequest.streamPriority.

Returns:StreamPriority

Doc from io.vertx.core.http.HttpServerRequest.streamPriority.

the priority of the associated HTTP/2 stream for HTTP/2 otherwise null

Annotations
@Override
streamPriorityHandlerback to summary
public HttpServerRequest streamPriorityHandler(Handler<StreamPriority> handler)

Implements io.vertx.core.http.HttpServerRequest.streamPriorityHandler.

Doc from io.vertx.core.http.HttpServerRequest.streamPriorityHandler.

Set an handler for stream priority changes

This is not implemented for HTTP/1.x.

Parameters
handler:Handler<StreamPriority>

the handler to be called when stream priority changes

Annotations
@Override
@Fluent
toNetSocketback to summary
public Future<NetSocket> toNetSocket()

Implements io.vertx.core.http.HttpServerRequest.toNetSocket.

Doc from io.vertx.core.http.HttpServerRequest.toNetSocket.

Like toNetSocket(Handler) but returns a Future of the asynchronous result

Annotations
@Override
toWebSocketback to summary
public Future<ServerWebSocket> toWebSocket()

Implements io.vertx.core.http.HttpServerRequest.toWebSocket.

Doc from io.vertx.core.http.HttpServerRequest.toWebSocket.

Like toWebSocket(Handler) but returns a Future of the asynchronous result

Annotations
@Override
uploadHandlerback to summary
public HttpServerRequest uploadHandler(@Nullable Handler<HttpServerFileUpload> uploadHandler)
Annotations
@Override
@Fluent
uriback to summary
public String uri()

Implements io.vertx.core.http.HttpServerRequest.uri.

Returns:String

Doc from io.vertx.core.http.HttpServerRequest.uri.

the URI of the request. This is usually a relative URI

Annotations
@Override
versionback to summary
public HttpVersion version()

Implements io.vertx.core.http.HttpServerRequest.version.

Returns:HttpVersion

Doc from io.vertx.core.http.HttpServerRequest.version.

the HTTP version of the request

Annotations
@Override