users@jersey.java.net

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

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 24 Feb 2015 17:33:08 +0100

Sure, you are allowed to do THAT.

The warning says that you need to be careful of updating headers from within a WriterInterceptor or MessageBodyWriter when using non-default connectors.

Marek

> On 22 Feb 2015, at 13:26, Maarten Boekhold <boekhold_at_gmx.com> wrote:
>
> Hi,
>
> The Client API documentation (https://jersey.java.net/documentation/latest/client.html#d0e4740 <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" <http://some.url/path>)
> .request()
> .header("SOAPAction", "someaction")
> .post(soapXML);
> Maarten