users@jersey.java.net

Re: [Jersey] modifying jersey client requests

From: Zoltan Arnold NAGY <Zoltan.Nagy_at_Sun.COM>
Date: Thu, 08 Oct 2009 22:34:46 +0200

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. :)

One question remains: is there a point setting the request's security
context (user, principal, ...) in the filter,
apart for providing it for general consumption outside jersey's scope
(for the running container, I guess)?

AFAICS, it's not used inside the resource in the example.

Is there a way to extract the current securitycontext (or even enforce
it) inside a resource?
I found an old mail in the ML archives discussing it, but have it ever
got implemented?

Thanks,
Zoltan