public class DefaultHttpClientRequest extends java.lang.Object implements HttpClientRequest
| Modifier and Type | Method and Description |
|---|---|
void |
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. |
void |
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 |
void |
exceptionHandler(Handler<java.lang.Exception> handler)
Set an exception handler on the stream
|
java.util.Map<java.lang.String,java.lang.Object> |
headers() |
HttpClientRequest |
putHeader(java.lang.String name,
java.lang.Object 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
|
void |
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(Buffer chunk,
Handler<java.lang.Void> doneHandler)
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,
Handler<java.lang.Void> doneHandler)
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. |
DefaultHttpClientRequest |
write(java.lang.String chunk,
java.lang.String enc,
Handler<java.lang.Void> doneHandler)
Write a
String to the request body, encoded with encoding enc. |
void |
writeBuffer(Buffer chunk)
Write some data to the stream.
|
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 java.util.Map<java.lang.String,java.lang.Object> headers()
headers in interface HttpClientRequestpublic HttpClientRequest putHeader(java.lang.String name, java.lang.Object value)
HttpClientRequestputHeader in interface HttpClientRequestname - The header namevalue - The header valuepublic void writeBuffer(Buffer chunk)
WriteStreamWriteStream.writeQueueFull() method before writing. This is done automatically if using a Pump.writeBuffer in interface WriteStreampublic DefaultHttpClientRequest write(Buffer chunk)
HttpClientRequestBuffer to the request body.write in interface HttpClientRequestpublic 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 DefaultHttpClientRequest write(Buffer chunk, Handler<java.lang.Void> doneHandler)
HttpClientRequestBuffer to the request body. The doneHandler is called after the buffer is actually written
to the wire.write in interface HttpClientRequestpublic DefaultHttpClientRequest write(java.lang.String chunk, Handler<java.lang.Void> doneHandler)
HttpClientRequestString to the request body, encoded in UTF-8.
The doneHandler is called after the buffer is actually written to the wire.write in interface HttpClientRequestpublic DefaultHttpClientRequest write(java.lang.String chunk, java.lang.String enc, Handler<java.lang.Void> doneHandler)
HttpClientRequestString to the request body, encoded with encoding enc. The doneHandler is called
after the buffer is actually written to the wire.write in interface HttpClientRequestpublic void 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 WriteStreampublic boolean writeQueueFull()
WriteStreamtrue if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)writeQueueFull in interface WriteStreampublic void drainHandler(Handler<java.lang.Void> handler)
WriteStreamPump for an example of this being used.drainHandler in interface WriteStreampublic void exceptionHandler(Handler<java.lang.Exception> handler)
WriteStreamexceptionHandler in interface WriteStreampublic void 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 HttpClientRequest