users@jersey.java.net

Re: [Jersey] modifying jersey client requests

From: Zoltan Arnold NAGY <Zoltan.Nagy_at_Sun.COM>
Date: Fri, 09 Oct 2009 10:13:38 +0200

Zoltan Arnold NAGY wrote:
> Paul Sandoz wrote:
>>
>> On Oct 7, 2009, at 5:36 PM, Felipe Gaucho wrote:
>>
>>> A filter?
>>>
>>
>> Yes, see ClientFilter and the source code for the LoggingFilter (see
>> below because java.net is so damn slow).
>>
>> You need to return an output stream in the implementation of
>> AbstractClientRequestAdapter .adapt that buffers the bytes then on
>> the close calculates the hash, sets the header and writes out the
>> bytes of the buffered output stream to the actual output stream.
> Thanks, it seems to be working. :)
Spoken too soon.
In the message to be hashed I need to add the method, the date, and
other data as well.

It seems to me that if I do a simple .get() (no entity present) and I do
attach an adapter with
request.setAdapter(new Adapter(request.getAdapter(), b));
then it's adapt() method wont even get called (at least I've put logging
there, and never saw
it's output).

In all the examples I've seen one only attaches such an adapter if
there's an entity present, so
I'm thinking that maybe these request adaptert are only used to modify
the entity's serialized form?

The minimalistic approach I'm trying can be seen here:
http://nagyz.pastebin.com/m215b96ff

Thanks,
Zoltan