users@jersey.java.net

[Jersey] Re: suppression of content-length header w/ jersey jax-rs client

From: Phillip Ross <phillip.w.g.ross_at_gmail.com>
Date: Wed, 16 Dec 2015 03:51:33 -0500

It probably doesn't make sense, but I was hoping that there would be some
trick to suppress the content-length header. Possibly a property that I
was overlooking or some http client transport configuration.

There is a remote chance that I could convince the api and sevice authors
to relax their constraint and perhaps ignore the content-length header
rather than throw an error when it's sent in the request, but I'm not
betting on that.

- Phillip



On Wed, Dec 16, 2015 at 3:26 AM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:

> Hi Philip,
>
> does it really make sense to send content-type without content-length?
>
> Pavel
>
> On 16/12/15 09:23, Phillip Ross wrote:
>
>> Hi all,
>>
>> Does anybody have any hints as to how one might suppress sending a
>> content-length header in a PUT request with JAX-RS client?
>>
>> I'm making requests against a REST API which takes a PUT request, but
>> does not allow sending a content-length header. With CURL it's possible to
>> do this with the following example:
>> curl -sS <endpoint>/stor/foo.json?metadata=true -X PUT \
>> -H 'content-type: application/json'
>>
>> I can't seem to figure out a way to prevent jersey jax-rs client from
>> sending a content-length header along in the request. Anyone have any
>> ideas?
>>
>> thanks in advance!
>> - Phillip
>>
>
>