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

public Class HttpClientRequestImpl

extends HttpClientRequestBase
implements HttpClientRequest
Class Inheritance
All Implemented Interfaces
io.vertx.core.http.HttpClientRequest, io.vertx.core.streams.WriteStream, io.vertx.core.streams.StreamBase
Imports
io.netty.buffer.ByteBuf, io.vertx.codegen.annotations.Nullable, io.vertx.core.*, io.vertx.core.buffer.Buffer, io.vertx.core.http.*, io.vertx.core.http.impl.headers.HeadersMultiMap, io.vertx.core.impl.Arguments, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.impl.logging.Logger, .LoggerFactory, io.vertx.core.net.HostAndPort, .SocketAddress, java.util.Objects, java.util.function.Function

This class is optimised for performance when used on the same event loop that is passed to the handler with. However it can be used safely from other threads. The internal state is protected using the synchronized keyword. If always used on the same event loop, then we benefit from biased locking which makes the overhead of synchronized near zero. This class uses this for synchronization purpose. The client orstream instead are called must not be called under this lock to avoid deadlocks.
Author
Tim Fox

Field Summary

Modifier and TypeField and Description
private boolean
private Handler<Void>
private Handler<Void>
private Handler<MultiMap>
private boolean
private final Future<Void>
private final Promise<Void>
private Handler<Throwable>
private boolean
private HeadersMultiMap
private boolean
private boolean
pack-priv static final Logger
private int
private int
private StreamPriority
private Function<HttpClientResponse, Future<HttpClientRequest>>
private String
Inherited from io.vertx.core.http.impl.HttpClientRequestBase:
contextserversslstream

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
private void
private void
public Future<HttpClientResponse>
connect()

Implements io.vertx.core.http.HttpClientRequest.connect.

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

public void
connect(Handler<AsyncResult<HttpClientResponse>>
the response completion handler
handler
)

Implements io.vertx.core.http.HttpClientRequest.connect.

Create an HTTP tunnel to the server.

public synchronized HttpConnection
public synchronized HttpClientRequest
private void
doWrite(ByteBuf buff, boolean end, boolean connect, Handler<AsyncResult<Void>> completionHandler)

public synchronized HttpClientRequest
public synchronized HttpClientRequest
public Future<Void>
end(String
the data chunk
chunk
)

Implements io.vertx.core.http.HttpClientRequest.end.

Same as end(Buffer) but writes a String in UTF-8 encoding

public void
end(String chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.end.

Same as end(String) but with an handler called when the operation completes

public Future<Void>
end(String
the data chunk
chunk
,
String
the encoding
enc
)

Implements io.vertx.core.http.HttpClientRequest.end.

Same as end(Buffer) but writes a String with the specified encoding

public void
end(String chunk, String enc, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.end.

Same as end(String, String) but with an handler called when the operation completes

public Future<Void>
end(Buffer
the data to write
chunk
)

Implements io.vertx.core.http.HttpClientRequest.end.

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

Same as end() but writes some data to the request body before ending.

public void
end(Buffer chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.end.

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

Same as end(String) but with an handler called when the operation completes

public Future<Void>
end()

Implements io.vertx.core.http.HttpClientRequest.end.

Ends the request.

public void
end(Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.end.

Same as end() but with an handler called when the operation completes

private synchronized Handler<Throwable>
public synchronized HttpClientRequest
public synchronized int
public synchronized StreamPriority
private void
private void
private void
pack-priv void
private void
pack-priv void
public synchronized MultiMap
public synchronized boolean
public synchronized boolean
public int
public synchronized HttpClientRequest
putHeader(String
The header name
name
,
String
The header value
value
)

Implements io.vertx.core.http.HttpClientRequest.putHeader.

Put an HTTP header

public synchronized HttpClientRequest
putHeader(String
The header name
name
,
Iterable<String>
The header values
values
)

Implements io.vertx.core.http.HttpClientRequest.putHeader.

Put an HTTP header with multiple values

public synchronized HttpClientRequest
public synchronized HttpClientRequest
public synchronized HttpClientRequest
private boolean
public Future<Void>
sendHead()

Implements io.vertx.core.http.HttpClientRequest.sendHead.

Forces the head of the request to be written before end() is called on the request or any data is written to it.

public HttpClientRequest
sendHead(Handler<AsyncResult<Void>> headersHandler)

Implements io.vertx.core.http.HttpClientRequest.sendHead.

Like sendHead() but with an handler after headers have been sent.

public synchronized HttpClientRequestImpl
setChunked(boolean
true if chunked encoding
chunked
)

Implements io.vertx.core.http.HttpClientRequest.setChunked.

If chunked is true then the request will be set into HTTP chunked mode

public synchronized HttpClientRequest
setFollowRedirects(boolean
true to follow HTTP redirects
followRedirects
)

Implements io.vertx.core.http.HttpClientRequest.setFollowRedirects.

Set the request to follow HTTP redirects up to HttpClientOptions#getMaxRedirects().

public synchronized HttpClientRequest
setMaxRedirects(int
the number of HTTP redirect to follow
maxRedirects
)

Implements io.vertx.core.http.HttpClientRequest.setMaxRedirects.

Set the max number of HTTP redirects this request will follow.

public synchronized HttpClientRequest
setStreamPriority(StreamPriority
the priority of this request's stream
priority
)

Overrides default io.vertx.core.http.HttpClientRequest.setStreamPriority.

Sets the priority of the associated stream.

public synchronized HttpClientRequest
setWriteQueueMaxSize(int
the max size of the write stream
maxSize
)

Implements io.vertx.core.http.HttpClientRequest.setWriteQueueMaxSize.

Set the maximum size of the write queue to maxSize.

public synchronized HttpClientRequest
traceOperation(String
the operation
op
)

Implements io.vertx.core.http.HttpClientRequest.traceOperation.

Set the trace operation of this request.

public String
private void
public HttpVersion
public Future<Void>
write(Buffer
the data to write
chunk
)

Implements io.vertx.core.streams.WriteStream.write.

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

Write some data to the stream.

public void
write(Buffer chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.streams.WriteStream.write.

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

Same as write(T) but with an handler called when the operation completes

public Future<Void>
write(String
the data chunk
chunk
)

Implements io.vertx.core.http.HttpClientRequest.write.

Write a String to the request body, encoded as UTF-8.

public void
write(String chunk, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.write.

Same as write(String) but with an handler called when the operation completes

public Future<Void>
write(String
the data chunk
chunk
,
String
the encoding
enc
)

Implements io.vertx.core.http.HttpClientRequest.write.

Write a String to the request body, encoded using the encoding enc.

public void
write(String chunk, String enc, Handler<AsyncResult<Void>> handler)

Implements io.vertx.core.http.HttpClientRequest.write.

Same as write(String, String) but with an handler called when the operation completes

private void
write(ByteBuf buff, boolean end, Handler<AsyncResult<Void>> completionHandler)

public HttpClientRequest
writeCustomFrame(int
the 8-bit frame type
type
,
int
the 8-bit frame flags
flags
,
Buffer
the frame payload
payload
)

Implements io.vertx.core.http.HttpClientRequest.writeCustomFrame.

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

Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol.

public boolean
writeQueueFull()

Implements io.vertx.core.streams.WriteStream.writeQueueFull.

This will return true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize

Inherited from io.vertx.core.http.impl.HttpClientRequestBase:
absoluteURIauthorityauthoritydataReceivedfailgetHostgetMethodgetPortgetURIhandlePushhandleResponsemapExceptionpathpushHandlerpushHandlerqueryresetresetresponseresponsesetHostsetMethodsetPortsetTimeoutsetURIstreamIdtimeoutEx