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)
HttpClientRequest
setChunked
in interface HttpClientRequest
public java.util.Map<java.lang.String,java.lang.Object> headers()
headers
in interface HttpClientRequest
public HttpClientRequest putHeader(java.lang.String name, java.lang.Object value)
HttpClientRequest
putHeader
in interface HttpClientRequest
name
- The header namevalue
- The header valuepublic void writeBuffer(Buffer chunk)
WriteStream
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.writeBuffer
in interface WriteStream
public DefaultHttpClientRequest write(Buffer chunk)
HttpClientRequest
Buffer
to the request body.write
in interface HttpClientRequest
public DefaultHttpClientRequest write(java.lang.String chunk)
HttpClientRequest
String
to the request body, encoded in UTF-8.write
in interface HttpClientRequest
public DefaultHttpClientRequest write(java.lang.String chunk, java.lang.String enc)
HttpClientRequest
String
to the request body, encoded using the encoding enc
.write
in interface HttpClientRequest
public DefaultHttpClientRequest write(Buffer chunk, Handler<java.lang.Void> doneHandler)
HttpClientRequest
Buffer
to the request body. The doneHandler
is called after the buffer is actually written
to the wire.write
in interface HttpClientRequest
public DefaultHttpClientRequest write(java.lang.String chunk, Handler<java.lang.Void> doneHandler)
HttpClientRequest
String
to the request body, encoded in UTF-8.
The doneHandler
is called after the buffer is actually written to the wire.write
in interface HttpClientRequest
public DefaultHttpClientRequest write(java.lang.String chunk, java.lang.String enc, Handler<java.lang.Void> doneHandler)
HttpClientRequest
String
to the request body, encoded with encoding enc
. The doneHandler
is called
after the buffer is actually written to the wire.write
in interface HttpClientRequest
public void setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. 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
public boolean writeQueueFull()
WriteStream
true
if there are more bytes in the write queue than the value set using WriteStream.setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream
public void drainHandler(Handler<java.lang.Void> handler)
WriteStream
Pump
for an example of this being used.drainHandler
in interface WriteStream
public void exceptionHandler(Handler<java.lang.Exception> handler)
WriteStream
exceptionHandler
in interface WriteStream
public void continueHandler(Handler<java.lang.Void> handler)
HttpClientRequest
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.
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 HttpClientRequest
public DefaultHttpClientRequest sendHead()
HttpClientRequest
HttpClientRequest.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 HttpClientRequest
public void end(java.lang.String chunk)
HttpClientRequest
HttpClientRequest.end(Buffer)
but writes a String with the default encodingend
in interface HttpClientRequest
public void end(java.lang.String chunk, java.lang.String enc)
HttpClientRequest
HttpClientRequest.end(Buffer)
but writes a String with the specified encodingend
in interface HttpClientRequest
public void end(Buffer chunk)
HttpClientRequest
HttpClientRequest.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 HttpClientRequest
public void end()
HttpClientRequest
HttpClientRequest.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