public class DefaultHttpClientRequest extends java.lang.Object implements HttpClientRequest
| Modifier and Type | Method and Description |
|---|---|
HttpClientRequest |
continueHandler(Handler<java.lang.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<java.lang.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(java.lang.String chunk)
Same as
HttpClientRequest.end(Buffer) but writes a String with the default encoding |
void |
end(java.lang.String chunk,
java.lang.String enc)
Same as
HttpClientRequest.end(Buffer) but writes a String with the specified encoding |
HttpClientRequest |
exceptionHandler(Handler<java.lang.Throwable> handler)
Set an exception handler.
|
MultiMap |
headers() |
boolean |
isChunked() |
HttpClientRequest |
putHeader(java.lang.String name,
java.lang.Iterable<java.lang.String> values)
Put an HTTP header - fluent API
|
HttpClientRequest |
putHeader(java.lang.String name,
java.lang.String value)
Put an HTTP header - fluent API
|
DefaultHttpClientRequest |
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. |
DefaultHttpClientRequest |
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. |
DefaultHttpClientRequest |
write(Buffer chunk)
Write a
Buffer to the request body. |
DefaultHttpClientRequest |
write(java.lang.String chunk)
Write a
String to the request body, encoded in UTF-8. |
DefaultHttpClientRequest |
write(java.lang.String chunk,
java.lang.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 DefaultHttpClientRequest setChunked(boolean chunked)
HttpClientRequestsetChunked in interface HttpClientRequestpublic boolean isChunked()
isChunked in interface HttpClientRequestpublic MultiMap headers()
headers in interface HttpClientRequestpublic HttpClientRequest putHeader(java.lang.String name, java.lang.String value)
HttpClientRequestputHeader in interface HttpClientRequestname - The header namevalue - The header valuepublic HttpClientRequest putHeader(java.lang.String name, java.lang.Iterable<java.lang.String> values)
HttpClientRequestputHeader in interface HttpClientRequestname - The header namevalues - The header valuespublic DefaultHttpClientRequest write(Buffer chunk)
HttpClientRequestBuffer to the request body.write in interface HttpClientRequestwrite in interface WriteStream<HttpClientRequest>public DefaultHttpClientRequest write(java.lang.String chunk)
HttpClientRequestString to the request body, encoded in UTF-8.write in interface HttpClientRequestpublic DefaultHttpClientRequest write(java.lang.String chunk, java.lang.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 WriteStream<HttpClientRequest>public boolean writeQueueFull()
WriteStreamtrue if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)writeQueueFull in interface WriteStream<HttpClientRequest>public HttpClientRequest drainHandler(Handler<java.lang.Void> handler)
WriteStreamPump for an example of this being used.drainHandler in interface WriteStream<HttpClientRequest>public HttpClientRequest exceptionHandler(Handler<java.lang.Throwable> handler)
ExceptionSupportexceptionHandler in interface ExceptionSupport<HttpClientRequest>public HttpClientRequest continueHandler(Handler<java.lang.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 DefaultHttpClientRequest 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(org.vertx.java.core.Handler) for more information.sendHead in interface HttpClientRequestpublic void end(java.lang.String chunk)
HttpClientRequestHttpClientRequest.end(Buffer) but writes a String with the default encodingend in interface HttpClientRequestpublic void end(java.lang.String chunk,
java.lang.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, and if keep alive is true the underlying connection will
be returned to the HttpClient pool so it can be assigned to another request.
end in interface HttpClientRequestpublic HttpClientRequest setTimeout(long timeoutMs)
HttpClientRequestsetTimeout in interface HttpClientRequesttimeoutMs - The quantity of time in milliseconds.