users@jersey.java.net

Re: [Jersey] Chunked encoding problem

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 17 Mar 2010 09:37:30 +0100

On Mar 16, 2010, at 10:42 AM, Paul Sandoz wrote:

> On Mar 16, 2010, at 10:33 AM, Paul Sandoz wrote:
>>
>> I need to investigate whether it is possible to set the headers
>> before any bytes are written to the OutputStream passed into
>> RequestEntity.writeRequest. I suspect not,
>
> I just verified this is the case. So i am gonna have to provide some
> sort of special interface on a MessageBodyWriter to modify the
> content type before serialization.
>

I looked into this further and even prototyped a solution, but i am
not happy with it. There is a fundamental mismatch between the Apache
HTTP client model and that supported by MessageBodyWriter that is hard
to resolve without doing some sort of hack.

The only thing that comes to mind is to calculate the boundary string
when an instance of MultiPart is created. This obviously precludes a
MultiPart instance embedding itself (which would not be possible
anyway at the moment because it would blow the stack up).

Could you log an issue?

Thanks,
Paul.