org.vertx.java.core.http.impl

## Class DefaultHttpClientRequest

- java.lang.Object
- - org.vertx.java.core.http.impl.DefaultHttpClientRequest

All Implemented Interfaces:
  HttpClientRequest, WriteStream

    public class DefaultHttpClientRequest
    extends java.lang.Object
    implements HttpClientRequest

### Method Summary

Methods
`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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### setChunked

    public DefaultHttpClientRequest setChunked(boolean chunked)

Description copied from interface: `HttpClientRequest`
If chunked is true then the request will be set into HTTP chunked mode

Specified by:
  `setChunked` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### headers

    public java.util.Map<java.lang.String,java.lang.Object> headers()

Specified by:
  `headers` in interface `HttpClientRequest`
Returns:
  The HTTP headers

#### putHeader

    public HttpClientRequest putHeader(java.lang.String name,
                              java.lang.Object value)

Description copied from interface: `HttpClientRequest`
Put an HTTP header - fluent API

Specified by:
  `putHeader` in interface `HttpClientRequest`
Parameters:
  `name` - The header name
  `value` - The header value
Returns:
  A reference to this, so multiple method calls can be chained.

#### writeBuffer

    public void writeBuffer(Buffer chunk)

Description copied from interface: `WriteStream`
Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a `Pump`.

Specified by:
  `writeBuffer` in interface `WriteStream`

#### write

    public DefaultHttpClientRequest write(Buffer chunk)

Description copied from interface: `HttpClientRequest`
Write a `Buffer` to the request body.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### write

    public DefaultHttpClientRequest write(java.lang.String chunk)

Description copied from interface: `HttpClientRequest`
Write a `String` to the request body, encoded in UTF-8.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### write

    public DefaultHttpClientRequest write(java.lang.String chunk,
                                 java.lang.String enc)

Description copied from interface: `HttpClientRequest`
Write a `String` to the request body, encoded using the encoding `enc`.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### write

    public DefaultHttpClientRequest write(Buffer chunk,
                                 Handler<java.lang.Void> doneHandler)

Description copied from interface: `HttpClientRequest`
Write a `Buffer` to the request body. The `doneHandler` is called after the buffer is actually written to the wire.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### write

    public DefaultHttpClientRequest write(java.lang.String chunk,
                                 Handler<java.lang.Void> doneHandler)

Description copied from interface: `HttpClientRequest`
Write a `String` to the request body, encoded in UTF-8. The `doneHandler` is called after the buffer is actually written to the wire.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### write

    public DefaultHttpClientRequest write(java.lang.String chunk,
                                 java.lang.String enc,
                                 Handler<java.lang.Void> doneHandler)

Description copied from interface: `HttpClientRequest`
Write a `String` to the request body, encoded with encoding `enc`. The `doneHandler` is called after the buffer is actually written to the wire.

Specified by:
  `write` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### setWriteQueueMaxSize

    public void setWriteQueueMaxSize(int maxSize)

Description copied from interface: `WriteStream`
Set the maximum size of the write queue to `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.

Specified by:
  `setWriteQueueMaxSize` in interface `WriteStream`

#### writeQueueFull

    public boolean writeQueueFull()

Description copied from interface: `WriteStream`
This will return `true` if there are more bytes in the write queue than the value set using `WriteStream.setWriteQueueMaxSize(int)`

Specified by:
  `writeQueueFull` in interface `WriteStream`

#### drainHandler

    public void drainHandler(Handler<java.lang.Void> handler)

Description copied from interface: `WriteStream`
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue has been reduced to maxSize / 2. See `Pump` for an example of this being used.

Specified by:
  `drainHandler` in interface `WriteStream`

#### exceptionHandler

    public void exceptionHandler(Handler<java.lang.Exception> handler)

Description copied from interface: `WriteStream`
Set an exception handler on the stream

Specified by:
  `exceptionHandler` in interface `WriteStream`

#### continueHandler

    public void continueHandler(Handler<java.lang.Void> handler)

Description copied from interface: `HttpClientRequest`
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.

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.

Specified by:
  `continueHandler` in interface `HttpClientRequest`

#### sendHead

    public DefaultHttpClientRequest sendHead()

Description copied from interface: `HttpClientRequest`
Forces the head of the request to be written before `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.

Specified by:
  `sendHead` in interface `HttpClientRequest`
Returns:
  A reference to this, so multiple method calls can be chained.

#### end

    public void end(java.lang.String chunk)

Description copied from interface: `HttpClientRequest`
Same as `HttpClientRequest.end(Buffer)` but writes a String with the default encoding

Specified by:
  `end` in interface `HttpClientRequest`

#### end

    public void end(java.lang.String chunk,
           java.lang.String enc)

Description copied from interface: `HttpClientRequest`
Same as `HttpClientRequest.end(Buffer)` but writes a String with the specified encoding

Specified by:
  `end` in interface `HttpClientRequest`

#### end

    public void end(Buffer chunk)

Description copied from interface: `HttpClientRequest`
Same as `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 set

Specified by:
  `end` in interface `HttpClientRequest`

#### end

    public void end()

Description copied from interface: `HttpClientRequest`
Ends the request. If no data has been written to the request body, and `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.

Specified by:
  `end` in interface `HttpClientRequest`