public class HttpClientRequestImpl extends HttpClientRequestBase implements HttpClientRequest
this for synchronization purpose. The HttpClientRequestBase.client orstream instead are
called must not be called under this lock to avoid deadlocks.| Modifier and Type | Method and Description |
|---|---|
protected void |
checkEnded() |
HttpConnection |
connection() |
HttpClientRequest |
connectionHandler(Handler<HttpConnection> handler)
Set a connection handler called when an HTTP connection has been established.
|
HttpClientRequest |
continueHandler(Handler<Void> handler)
If you send an HTTP request with the header
Expect set to the value 100-continue
and the server responds with an interim HTTP response with a status code of 100 and a continue handler
has been set using this method, then the handler will be called. |
HttpClientRequest |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
void |
end()
Ends the request.
|
void |
end(Buffer chunk)
Same as
HttpClientRequest.end() but writes some data to the request body before ending. |
void |
end(Buffer chunk,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.end(String) but with an handler called when the operation completes |
void |
end(Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.end() but with an handler called when the operation completes |
void |
end(String chunk)
Same as
HttpClientRequest.end(Buffer) but writes a String in UTF-8 encoding |
void |
end(String chunk,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.end(String) but with an handler called when the operation completes |
void |
end(String chunk,
String enc)
Same as
HttpClientRequest.end(Buffer) but writes a String with the specified encoding |
void |
end(String chunk,
String enc,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.end(String,String) but with an handler called when the operation completes |
HttpClientRequest |
endHandler(Handler<Void> handler)
Set an end handler.
|
String |
getHost() |
String |
getRawMethod() |
StreamPriority |
getStreamPriority() |
void |
handleException(Throwable t) |
HttpClientRequest |
handler(Handler<HttpClientResponse> handler)
Set a data handler.
|
MultiMap |
headers() |
protected String |
hostHeader() |
boolean |
isChunked() |
HttpClientRequest |
pushHandler(Handler<HttpClientRequest> handler)
Set a push handler for this request.
The handler is called when the client receives a push promise from the server.
|
HttpClientRequest |
putHeader(CharSequence name,
CharSequence value)
Like
HttpClientRequest.putHeader(String, String) but using CharSequence |
HttpClientRequest |
putHeader(CharSequence name,
Iterable<CharSequence> values)
Like
HttpClientRequest.putHeader(String, Iterable) but using CharSequence |
HttpClientRequest |
putHeader(String name,
Iterable<String> values)
Put an HTTP header with multiple values
|
HttpClientRequest |
putHeader(String name,
String value)
Put an HTTP header
|
HttpClientRequest |
sendHead()
Forces the head of the request to be written before
HttpClientRequest.end() is called on the request or any data is
written to it. |
HttpClientRequest |
sendHead(Handler<HttpVersion> headersHandler)
Like
HttpClientRequest.sendHead() but with an handler after headers have been sent. |
HttpClientRequestImpl |
setChunked(boolean chunked)
If chunked is true then the request will be set into HTTP chunked mode
|
HttpClientRequest |
setFollowRedirects(boolean followRedirects)
Set the request to follow HTTP redirects up to
HttpClientOptions.getMaxRedirects(). |
HttpClientRequest |
setHost(String host)
Set the request host.
For HTTP/2 it sets the :authority pseudo header otherwise it sets the Host header
|
HttpClientRequest |
setMaxRedirects(int maxRedirects)
Set the max number of HTTP redirects this request will follow.
|
HttpClientRequest |
setRawMethod(String method)
Set the value the method to send when the method
HttpMethod.OTHER is used. |
HttpClientRequest |
setStreamPriority(StreamPriority priority)
Sets the priority of the associated stream.
|
HttpClientRequest |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
int |
streamId() |
HttpClientRequest |
write(Buffer chunk)
Write some data to the stream.
|
HttpClientRequest |
write(Buffer chunk,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.write(Buffer) but with an handler called when the operation completes |
HttpClientRequest |
write(String chunk)
Write a
String to the request body, encoded as UTF-8. |
HttpClientRequest |
write(String chunk,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.write(String) but with an handler called when the operation completes |
HttpClientRequest |
write(String chunk,
String enc)
Write a
String to the request body, encoded using the encoding enc. |
HttpClientRequest |
write(String chunk,
String enc,
Handler<AsyncResult<Void>> handler)
Same as
HttpClientRequest.write(String,String) but with an handler called when the operation completes |
HttpClientRequest |
writeCustomFrame(int type,
int flags,
Buffer payload)
Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol.
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int) |
absoluteURI, exceptionHandler, fetch, host, method, path, pause, query, reset, resume, setTimeout, uriclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitabsoluteURI, exceptionHandler, fetch, method, path, pause, query, reset, reset, resume, setTimeout, uri, writeCustomFramepipe, pipeTo, pipeTopublic int streamId()
streamId in interface HttpClientRequestpublic HttpClientRequest handler(Handler<HttpClientResponse> handler)
ReadStreamhandler in interface HttpClientRequesthandler in interface ReadStream<HttpClientResponse>public HttpClientRequest setFollowRedirects(boolean followRedirects)
HttpClientRequestHttpClientOptions.getMaxRedirects().setFollowRedirects in interface HttpClientRequestfollowRedirects - true to follow HTTP redirectspublic HttpClientRequest setMaxRedirects(int maxRedirects)
HttpClientRequest0 which means
no redirects.setMaxRedirects in interface HttpClientRequestmaxRedirects - the number of HTTP redirect to followpublic HttpClientRequest endHandler(Handler<Void> handler)
ReadStreamendHandler in interface HttpClientRequestendHandler in interface ReadStream<HttpClientResponse>public HttpClientRequestImpl setChunked(boolean chunked)
HttpClientRequestsetChunked in interface HttpClientRequestchunked - true if chunked encodingpublic boolean isChunked()
isChunked in interface HttpClientRequestpublic String getRawMethod()
getRawMethod in interface HttpClientRequestpublic HttpClientRequest setRawMethod(String method)
HttpClientRequestHttpMethod.OTHER is used.setRawMethod in interface HttpClientRequestmethod - the raw methodpublic HttpClientRequest setHost(String host)
HttpClientRequestsetHost in interface HttpClientRequestpublic String getHost()
getHost in interface HttpClientRequestpublic MultiMap headers()
headers in interface HttpClientRequestpublic HttpClientRequest putHeader(String name, String value)
HttpClientRequestputHeader in interface HttpClientRequestname - The header namevalue - The header valuepublic HttpClientRequest putHeader(String name, Iterable<String> values)
HttpClientRequestputHeader in interface HttpClientRequestname - The header namevalues - The header valuespublic HttpClientRequest setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. You will still be able to write to the stream even
if there is more than maxSize items in the write queue. This is used as an indicator by classes such as
Pump to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket, the number of Message for a
MessageProducer, etc...setWriteQueueMaxSize in interface HttpClientRequestsetWriteQueueMaxSize in interface WriteStream<Buffer>maxSize - the max size of the write streampublic boolean writeQueueFull()
WriteStreamtrue if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)writeQueueFull in interface WriteStream<Buffer>public HttpClientRequest drainHandler(Handler<Void> handler)
WriteStreamPump for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2.drainHandler in interface HttpClientRequestdrainHandler in interface WriteStream<Buffer>handler - the handlerpublic HttpClientRequest continueHandler(Handler<Void> handler)
HttpClientRequestExpect set to the value 100-continue
and the server responds with an interim HTTP response with a status code of 100 and a continue handler
has been set using this method, then the handler will be called.
You can then continue to write data to the request body and later end it. This is normally used in conjunction with
the HttpClientRequest.sendHead() method to force the request header to be written before the request has ended.
continueHandler in interface HttpClientRequestpublic HttpClientRequest sendHead()
HttpClientRequestHttpClientRequest.end() is called on the request or any data is
written to it.
This is normally used to implement HTTP 100-continue handling, see HttpClientRequest.continueHandler(io.vertx.core.Handler) for
more information.
sendHead in interface HttpClientRequestpublic HttpClientRequest sendHead(Handler<HttpVersion> headersHandler)
HttpClientRequestHttpClientRequest.sendHead() but with an handler after headers have been sent. The handler will be called with
the HttpVersion if it can be determined or null otherwise.sendHead in interface HttpClientRequestpublic HttpClientRequest putHeader(CharSequence name, CharSequence value)
HttpClientRequestHttpClientRequest.putHeader(String, String) but using CharSequenceputHeader in interface HttpClientRequestpublic HttpClientRequest putHeader(CharSequence name, Iterable<CharSequence> values)
HttpClientRequestHttpClientRequest.putHeader(String, Iterable) but using CharSequenceputHeader in interface HttpClientRequestpublic HttpClientRequest pushHandler(Handler<HttpClientRequest> handler)
HttpClientRequestHttpClientRequest, the following methods can be called:
HttpClientRequest.method()HttpClientRequest.uri()HttpClientRequest.headers()HttpClientRequest.getHost()HttpClientRequest.handler(io.vertx.core.Handler<io.vertx.core.http.HttpClientResponse>) method to set an handler to
process the response.pushHandler in interface HttpClientRequesthandler - the handlerpublic HttpConnection connection()
connection in interface HttpClientRequestHttpConnection associated with this requestpublic HttpClientRequest connectionHandler(Handler<HttpConnection> handler)
HttpClientRequestconnectionHandler in interface HttpClientRequesthandler - the handlerpublic HttpClientRequest writeCustomFrame(int type, int flags, Buffer payload)
HttpClientRequestThe frame is sent immediatly and is not subject to flow control.
This method must be called after the request headers have been sent and only for the protocol HTTP/2.
The HttpClientRequest.sendHead(Handler) should be used for this purpose.
writeCustomFrame in interface HttpClientRequesttype - the 8-bit frame typeflags - the 8-bit frame flagspayload - the frame payloadpublic void handleException(Throwable t)
handleException in class HttpClientRequestBaseprotected String hostHeader()
hostHeader in class HttpClientRequestBasepublic void end(String chunk)
HttpClientRequestHttpClientRequest.end(Buffer) but writes a String in UTF-8 encodingend in interface HttpClientRequestpublic void end(String chunk, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.end(String) but with an handler called when the operation completesend in interface HttpClientRequestpublic void end(String chunk, String enc)
HttpClientRequestHttpClientRequest.end(Buffer) but writes a String with the specified encodingend in interface HttpClientRequestpublic void end(String chunk, String enc, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.end(String,String) but with an handler called when the operation completesend in interface HttpClientRequestpublic void end(Buffer chunk)
HttpClientRequestHttpClientRequest.end() but writes some data to the request body before ending. If the request is not chunked and
no other data has been written then the Content-Length header will be automatically setend in interface HttpClientRequestend in interface WriteStream<Buffer>chunk - the data to writepublic void end(Buffer chunk, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.end(String) but with an handler called when the operation completesend in interface HttpClientRequestend in interface WriteStream<Buffer>public void end()
HttpClientRequestHttpClientRequest.sendHead() has not been called then
the actual request won't get written until this method gets called.
Once the request has ended, it cannot be used any more,
end in interface HttpClientRequestend in interface WriteStream<Buffer>public void end(Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.end() but with an handler called when the operation completesend in interface HttpClientRequestend in interface WriteStream<Buffer>public HttpClientRequest write(Buffer chunk)
WriteStreamWriteStream.writeQueueFull() method before writing. This is done automatically if using a Pump.write in interface HttpClientRequestwrite in interface WriteStream<Buffer>chunk - the data to writepublic HttpClientRequest write(Buffer chunk, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.write(Buffer) but with an handler called when the operation completeswrite in interface HttpClientRequestwrite in interface WriteStream<Buffer>public HttpClientRequest write(String chunk)
HttpClientRequestString to the request body, encoded as UTF-8.write in interface HttpClientRequestpublic HttpClientRequest write(String chunk, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.write(String) but with an handler called when the operation completeswrite in interface HttpClientRequestpublic HttpClientRequest write(String chunk, String enc)
HttpClientRequestString to the request body, encoded using the encoding enc.write in interface HttpClientRequestpublic HttpClientRequest write(String chunk, String enc, Handler<AsyncResult<Void>> handler)
HttpClientRequestHttpClientRequest.write(String,String) but with an handler called when the operation completeswrite in interface HttpClientRequestprotected void checkEnded()
checkEnded in class HttpClientRequestBasepublic HttpClientRequest setStreamPriority(StreamPriority priority)
HttpClientRequestsetStreamPriority in interface HttpClientRequestpriority - the priority of this request's streampublic StreamPriority getStreamPriority()
getStreamPriority in interface HttpClientRequestnullCopyright © 2020. All rights reserved.