public class HttpClientRequestImpl extends Object implements HttpClientRequest
| Modifier and Type | Method and Description |
|---|---|
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(String chunk)
Same as
HttpClientRequest.end(Buffer) but writes a String in UTF-8 encoding |
void |
end(String chunk,
String enc)
Same as
HttpClientRequest.end(Buffer) but writes a String with the specified encoding |
HttpClientRequest |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
HttpClientRequest |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
HttpClientRequest |
handler(Handler<HttpClientResponse> handler)
Set a data handler.
|
MultiMap |
headers() |
boolean |
isChunked() |
HttpMethod |
method()
The HTTP method for the request.
|
HttpClientRequest |
pause()
Pause the
ReadSupport. |
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 |
resume()
Resume reading.
|
HttpClientRequestImpl |
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. |
HttpClientRequestImpl |
setChunked(boolean chunked)
If chunked is true then the request will be set into HTTP chunked mode
|
HttpClientRequest |
setTimeout(long timeoutMs)
Set's the amount of time after which if a response is not received
TimeoutException
will be sent to the exception handler of this request. |
HttpClientRequest |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
String |
uri() |
HttpClientRequestImpl |
write(Buffer chunk)
Write some data to the stream.
|
HttpClientRequestImpl |
write(String chunk)
Write a
String to the request body, encoded as UTF-8. |
HttpClientRequestImpl |
write(String chunk,
String enc)
Write a
String to the request body, encoded using the encoding enc. |
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int) |
public HttpClientRequest handler(Handler<HttpClientResponse> handler)
ReadStreamhandler in interface HttpClientRequesthandler in interface ReadStream<HttpClientResponse>public HttpClientRequest pause()
ReadStreamReadSupport. While it's paused, no data will be sent to the dataHandlerpause in interface HttpClientRequestpause in interface ReadStream<HttpClientResponse>public HttpClientRequest resume()
ReadStreamReadSupport has been paused, reading will recommence on it.resume in interface HttpClientRequestresume in interface ReadStream<HttpClientResponse>public HttpClientRequest endHandler(Handler<Void> endHandler)
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 HttpMethod method()
HttpClientRequestmethod in interface HttpClientRequestpublic String uri()
uri 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 HttpClientRequestImpl 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 HttpClientRequestImpl write(String chunk)
HttpClientRequestString to the request body, encoded as UTF-8.write in interface HttpClientRequestpublic HttpClientRequestImpl write(String chunk, String enc)
HttpClientRequestString to the request body, encoded using the encoding enc.write in interface HttpClientRequestpublic HttpClientRequest setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. You will still be able to write to the stream even
if there is more than maxSize bytes in the write queue. This is used as an indicator by classes such as
Pump to provide flow control.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.drainHandler in interface HttpClientRequestdrainHandler in interface WriteStream<Buffer>handler - the handlerpublic HttpClientRequest exceptionHandler(Handler<Throwable> handler)
WriteStreamexceptionHandler in interface HttpClientRequestexceptionHandler in interface ReadStream<HttpClientResponse>exceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Buffer>handler - the exception 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 HttpClientRequestImpl 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 void end(String chunk)
HttpClientRequestHttpClientRequest.end(Buffer) but writes a String in UTF-8 encodingend 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(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 HttpClientRequestpublic 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 HttpClientRequestpublic HttpClientRequest setTimeout(long timeoutMs)
HttpClientRequestTimeoutException
will be sent to the exception handler of this request.
Calling this method more than once has the effect of canceling any existing timeout and starting the timeout from scratch.
setTimeout in interface HttpClientRequesttimeoutMs - The quantity of time in milliseconds.public 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 HttpClientRequestCopyright © 2015. All Rights Reserved.