users@jersey.java.net

[Jersey] Documentation warning on HTTP headers handling in Client API

From: Maarten Boekhold <boekhold_at_gmx.com>
Date: Sun, 22 Feb 2015 16:26:13 +0400

Hi,

The Client API documentation
(https://jersey.java.net/documentation/latest/client.html#d0e4740)
contains a warning:

    Be aware of using other than default |Connector| implementation.
    There is an issue handling HTTP headers in |WriterInterceptor| or
    |MessageBodyWriter<T>|. If you need to change header fields do not
    use nor |ApacheConnectorProvider| nor |GrizzlyConnectorProvider|
    neither |JettyConnectorProvider|. The issue for example applies to
    Jersey Multipart
    <https://jersey.java.net/documentation/latest/media.html#multipart>
    feature that also modifies HTTP headers.


What exactly does this mean? Does this mean for example that I'm not
allowed to do the following?

    ClientConfig clientConfig = new ClientConfig();
    clientConfig.connectorProvider(new JettyConnectorProvider());
    String response = ClientBuilder.newClient()
         .target("http://some.url/path")
         .request()
    *.header("SOAPAction", "someaction")*
         .post(soapXML);

Maarten