## com.sun.jersey.api.client
Class RequestWriter

    java.lang.Object
      com.sun.jersey.api.client.RequestWriter

Direct Known Subclasses:
  TerminatingClientHandler

    public class RequestWriter

extends java.lang.Object

A request writer for writing header values and a request entity.

Author:
  Paul.Sandoz@Sun.Com

Nested Class Summary
`protected static interface` | `RequestWriter.RequestEntityWriter` A writer for writing a request entity.
`protected static interface` | `RequestWriter.RequestEntityWriterListener` A lister for listening to events when writing a request entity.

Field Summary
`protected static java.lang.annotation.Annotation[]` | `EMPTY_ANNOTATIONS`

Constructor Summary
`RequestWriter()`
`RequestWriter(MessageBodyWorkers workers)`

Method Summary
`MessageBodyWorkers` | `getMessageBodyWorkers()`
`protected RequestWriter.RequestEntityWriter` | `getRequestEntityWriter(ClientRequest ro)` Get a request entity writer capable of writing the request entity.
`void` | `setMessageBodyWorkers(MessageBodyWorkers workers)`
`protected void` | `writeRequestEntity(ClientRequest ro, RequestWriter.RequestEntityWriterListener listener)` Write a request entity using an appropriate message body writer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_ANNOTATIONS

    protected static final java.lang.annotation.Annotation[] EMPTY_ANNOTATIONS

Constructor Detail

### RequestWriter

    public RequestWriter()

### RequestWriter

    public RequestWriter(MessageBodyWorkers workers)

Method Detail

### setMessageBodyWorkers

    @Context
    public void setMessageBodyWorkers(MessageBodyWorkers workers)

### getMessageBodyWorkers

    public MessageBodyWorkers getMessageBodyWorkers()

### getRequestEntityWriter

    protected RequestWriter.RequestEntityWriter getRequestEntityWriter(ClientRequest ro)

  Get a request entity writer capable of writing the request entity.

  Parameters:
    `ro` - the client request.
  Returns:
    the request entity writer.

### writeRequestEntity

    protected void writeRequestEntity(ClientRequest ro,
                                      RequestWriter.RequestEntityWriterListener listener)
                               throws java.io.IOException

  Write a request entity using an appropriate message body writer.

  The method `RequestWriter.RequestEntityWriterListener.onRequestEntitySize(long)` will be invoked with the size of the request entity to be serialized. The method `RequestWriter.RequestEntityWriterListener.onGetOutputStream()` will be invoked when the output stream is required to write the request entity.

  Parameters:
    `ro` - the client request containing the request entity. If the request entity is null then the method will not write any entity.
    `listener` - the request entity listener.
  Throws:
    `java.io.IOException`

Copyright © 2017 Oracle Corporation. All Rights Reserved.