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

public abstract Class HttpClientRequestBase

extends Object
implements HttpClientRequest
Class Inheritance
All Implemented Interfaces
io.vertx.core.http.HttpClientRequest, io.vertx.core.streams.WriteStream, io.vertx.core.streams.StreamBase
Known Direct Subclasses
io.vertx.core.http.impl.HttpClientRequestImpl, io.vertx.core.http.impl.HttpClientRequestPushPromise
Imports
io.netty.handler.codec.http2.Http2Error, io.vertx.core.AsyncResult, .Future, .Handler, .Promise, io.vertx.core.http.*, io.vertx.core.impl.ContextInternal, .NoStackTraceTimeoutException, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.net.HostAndPort, .SocketAddress, java.util.Objects

Author
Julien Viet

Field Summary

Modifier and TypeField and Description
protected final ContextInternal
private long
private long
private String
private long
private HttpMethod
private String
private int
private Handler<HttpClientRequest>
private String
private Throwable
private final PromiseInternal<HttpClientResponse>
protected final SocketAddress
protected final boolean
protected final HttpClientStream
private String

Constructor Summary

AccessConstructor and Description
pack-priv
HttpClientRequestBase(HttpClientStream stream, PromiseInternal<HttpClientResponse> responsePromise, HttpMethod method, SocketAddress server, String host, int port, String uri)

Method Summary

Modifier and TypeMethod and Description
public String
protected String
public synchronized HttpClientRequest
authority(HostAndPort
override the request authority
authority
)

Implements io.vertx.core.http.HttpClientRequest.authority.

Override the request authority, when using HTTP/1.x this overrides the request host header, when using HTTP/2 this sets the authority pseudo header.

private synchronized long
pack-priv synchronized void
pack-priv void
public String
public synchronized HttpMethod
getMethod()

Implements io.vertx.core.http.HttpClientRequest.getMethod.

The HTTP method for the request.

public int
public synchronized String
pack-priv void
pack-priv void
pack-priv void
pack-priv abstract void
private void
handleTimeout(long timeoutMs)

protected Throwable
public String
pack-priv synchronized Handler<HttpClientRequest>
public synchronized HttpClientRequest
pushHandler(Handler<HttpClientRequest>
the handler
handler
)

Implements io.vertx.core.http.HttpClientRequest.pushHandler.

Set a push handler for this request.

public String
public boolean
reset(long
the error code
code
)

Implements io.vertx.core.http.HttpClientRequest.reset.

Reset this request:

  • for HTTP/2, this performs send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, this closes the connection when the current request is inflight
public boolean
reset(long
the error code
code
,
Throwable
an optional cause that can be attached to the error code
cause
)

Implements io.vertx.core.http.HttpClientRequest.reset.

Reset this request:

  • for HTTP/2, send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, close the connection when the current request is inflight
private boolean
public HttpClientRequest
response(Handler<AsyncResult<HttpClientResponse>>
the completion handler
handler
)

Implements io.vertx.core.http.HttpClientRequest.response.

Set a callback for the associated HttpClientResponse.

public Future<HttpClientResponse>
public synchronized HttpClientRequest
setHost(String
the host part of the HTTP/1.1 host header or HTTP/2 authority pseudo header
host
)

Implements io.vertx.core.http.HttpClientRequest.setHost.

Set the host value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

The initial value is the same as the server socket address host.

public synchronized HttpClientRequest
setMethod(HttpMethod
the HTTP method
method
)

Implements io.vertx.core.http.HttpClientRequest.setMethod.

Set the HTTP method for this request.

public synchronized HttpClientRequest
setPort(int
the port part of the HTTP/1.1 host header or HTTP/2 authority pseudo header
port
)

Implements io.vertx.core.http.HttpClientRequest.setPort.

Set the port value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

Keep in mind that this won't change the actual server socket address for this request.

public synchronized HttpClientRequest
setTimeout(long timeout)

Implements io.vertx.core.http.HttpClientRequest.setTimeout.

Like idleTimeout(long) but with a confusing name (hence the deprecation).

public synchronized HttpClientRequest
setURI(String
the request uri
uri
)

Implements io.vertx.core.http.HttpClientRequest.setURI.

Set the request uri.

public int
pack-priv static NoStackTraceTimeoutException
timeoutEx(long timeoutMs, HttpMethod method, SocketAddress server, String uri)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
protected final ContextInternal context
currentTimeoutMsback to summary
private long currentTimeoutMs
currentTimeoutTimerIdback to summary
private long currentTimeoutTimerId
hostback to summary
private String host
lastDataReceivedback to summary
private long lastDataReceived
methodback to summary
private HttpMethod method
pathback to summary
private String path
portback to summary
private int port
pushHandlerback to summary
private Handler<HttpClientRequest> pushHandler
queryback to summary
private String query
resetback to summary
private Throwable reset
responsePromiseback to summary
private final PromiseInternal<HttpClientResponse> responsePromise
serverback to summary
protected final SocketAddress server
sslback to summary
protected final boolean ssl
streamback to summary
protected final HttpClientStream stream
uriback to summary
private String uri

Constructor Detail

HttpClientRequestBaseback to summary
pack-priv HttpClientRequestBase(HttpClientStream stream, PromiseInternal<HttpClientResponse> responsePromise, HttpMethod method, SocketAddress server, String host, int port, String uri)

Method Detail

absoluteURIback to summary
public String absoluteURI()

Implements io.vertx.core.http.HttpClientRequest.absoluteURI.

Returns:String

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

the absolute URI corresponding to the HTTP request

Annotations
@Override
authorityback to summary
protected String authority()
authorityback to summary
public synchronized HttpClientRequest authority(HostAndPort authority)

Implements io.vertx.core.http.HttpClientRequest.authority.

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

Override the request authority, when using HTTP/1.x this overrides the request host header, when using HTTP/2 this sets the authority pseudo header. When the port is a negative value, the default scheme port will be used.

The default request authority is the server host and port when connecting to the server.

Parameters
authority:HostAndPort

override the request authority

Returns:HttpClientRequest

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

Annotations
@Override
cancelTimeoutback to summary
private synchronized long cancelTimeout()
dataReceivedback to summary
pack-priv synchronized void dataReceived()
failback to summary
pack-priv void fail(Throwable t)
getHostback to summary
public String getHost()

Implements io.vertx.core.http.HttpClientRequest.getHost.

Returns:String

Doc from io.vertx.core.http.HttpClientRequest.getHost.

the host value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

getMethodback to summary
public synchronized HttpMethod getMethod()

Implements io.vertx.core.http.HttpClientRequest.getMethod.

Doc from io.vertx.core.http.HttpClientRequest.getMethod.

The HTTP method for the request.

Annotations
@Override
getPortback to summary
public int getPort()

Implements io.vertx.core.http.HttpClientRequest.getPort.

Returns:int

Doc from io.vertx.core.http.HttpClientRequest.getPort.

the port value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

Annotations
@Override
getURIback to summary
public synchronized String getURI()

Implements io.vertx.core.http.HttpClientRequest.getURI.

Returns:String

Doc from io.vertx.core.http.HttpClientRequest.getURI.

The URI of the request.

handleExceptionback to summary
pack-priv void handleException(Throwable t)
handlePushback to summary
pack-priv void handlePush(HttpClientPush push)
handleResponseback to summary
pack-priv void handleResponse(HttpClientResponse resp)
handleResponseback to summary
pack-priv abstract void handleResponse(Promise<HttpClientResponse> promise, HttpClientResponse resp, long timeoutMs)
handleTimeoutback to summary
private void handleTimeout(long timeoutMs)
mapExceptionback to summary
protected Throwable mapException(Throwable t)
pathback to summary
public String path()

Implements io.vertx.core.http.HttpClientRequest.path.

Returns:String

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

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

pushHandlerback to summary
pack-priv synchronized Handler<HttpClientRequest> pushHandler()
pushHandlerback to summary
public synchronized HttpClientRequest pushHandler(Handler<HttpClientRequest> handler)

Implements io.vertx.core.http.HttpClientRequest.pushHandler.

Doc from io.vertx.core.http.HttpClientRequest.pushHandler.

Set a push handler for this request.

The handler is called when the client receives a push promise from the server. The handler can be called multiple times, for each push promise.

The handler is called with a read-only HttpClientRequest, the following methods can be called:

In addition the handler should call the HttpClientRequest#response(Handler) method to set an handler to process the response.

Parameters
handler:Handler<HttpClientRequest>

the handler

Returns:HttpClientRequest

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

Annotations
@Override
queryback to summary
public String query()

Implements io.vertx.core.http.HttpClientRequest.query.

Returns:String

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

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

resetback to summary
public boolean reset(long code)

Implements io.vertx.core.http.HttpClientRequest.reset.

Doc from io.vertx.core.http.HttpClientRequest.reset.

Reset this request:

  • for HTTP/2, this performs send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, this closes the connection when the current request is inflight

When the request has not yet been sent, the request will be aborted and false is returned as indicator.

Parameters
code:long

the error code

Returns:boolean

true when reset has been performed

Annotations
@Override
resetback to summary
public boolean reset(long code, Throwable cause)

Implements io.vertx.core.http.HttpClientRequest.reset.

Doc from io.vertx.core.http.HttpClientRequest.reset.

Reset this request:

  • for HTTP/2, send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, close the connection when the current request is inflight

When the request has not yet been sent, the request will be aborted and false is returned as indicator.

Parameters
code:long

the error code

cause:Throwable

an optional cause that can be attached to the error code

Returns:boolean

true when reset has been performed

Annotations
@Override
resetback to summary
private boolean reset(Throwable cause)
responseback to summary
public HttpClientRequest response(Handler<AsyncResult<HttpClientResponse>> handler)

Implements io.vertx.core.http.HttpClientRequest.response.

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

Set a callback for the associated HttpClientResponse.

This method does not modify the current request being sent.

Parameters
handler:Handler<AsyncResult<HttpClientResponse>>

the completion handler

Returns:HttpClientRequest

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

Annotations
@Override
responseback to summary
public Future<HttpClientResponse> response()

Implements io.vertx.core.http.HttpClientRequest.response.

Returns:Future<HttpClientResponse>

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

a future of the HttpClientResponse, see response(Handler)

Annotations
@Override
setHostback to summary
public synchronized HttpClientRequest setHost(String host)

Implements io.vertx.core.http.HttpClientRequest.setHost.

Doc from io.vertx.core.http.HttpClientRequest.setHost.

Set the host value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

The initial value is the same as the server socket address host.

Keep in mind that changing this value won't change the actual server socket address for this request.

Parameters
host:String

the host part of the HTTP/1.1 host header or HTTP/2 authority pseudo header

Returns:HttpClientRequest

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

Annotations
@Override
setMethodback to summary
public synchronized HttpClientRequest setMethod(HttpMethod method)

Implements io.vertx.core.http.HttpClientRequest.setMethod.

Doc from io.vertx.core.http.HttpClientRequest.setMethod.

Set the HTTP method for this request.

Parameters
method:HttpMethod

the HTTP method

Returns:HttpClientRequest

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

Annotations
@Override
setPortback to summary
public synchronized HttpClientRequest setPort(int port)

Implements io.vertx.core.http.HttpClientRequest.setPort.

Doc from io.vertx.core.http.HttpClientRequest.setPort.

Set the port value of the HTTP/1.1 host header or HTTP/2 authority pseudo header

Keep in mind that this won't change the actual server socket address for this request.

The initial value is the same than the server socket address port.

Parameters
port:int

the port part of the HTTP/1.1 host header or HTTP/2 authority pseudo header

Returns:HttpClientRequest

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

Annotations
@Override
setTimeoutback to summary
public synchronized HttpClientRequest setTimeout(long timeout)

Implements io.vertx.core.http.HttpClientRequest.setTimeout.

Doc from io.vertx.core.http.HttpClientRequest.setTimeout.

Like idleTimeout(long) but with a confusing name (hence the deprecation).

Annotations
@Override
setURIback to summary
public synchronized HttpClientRequest setURI(String uri)

Implements io.vertx.core.http.HttpClientRequest.setURI.

Doc from io.vertx.core.http.HttpClientRequest.setURI.

Set the request uri.

Parameters
uri:String

the request uri

Returns:HttpClientRequest

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.HttpClientRequest.streamId.

Returns:int

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

the id of the stream of this response, -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
timeoutExback to summary
pack-priv static NoStackTraceTimeoutException timeoutEx(long timeoutMs, HttpMethod method, SocketAddress server, String uri)