What I've done in the past is in my JTF client is to call getClientReponseStatus() on the CLientResponse from POSTing to a login form and check its status. If it's 'OK' then I get the cookies from the Response, iterate over them, find the jsessionid cookie and put it into a static on the client class, then when in future calls to the server I add it back into the webResource with .cookie(...).
-Noah
On Sep 10, 2012, at 10:37 AM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
> Hello Christof,
>
> you'll need to implement session support by yourself, there is not in-built support for it. (it shouldn't be that hard, basically you want to create ContainerRequestFilter which would manage your sessions).
>
> Regards,
> Pavel
>
> On 8/30/12 6:19 PM, Christof Doll wrote:
>> Hi,
>>
>> in my current project I use a JaxRS interface between a JavaScript client and a Java server. Users authenticate via a form post. Afterwards the session id is stored in a cookie. I know that this is not restful. However, I don’t want authentication upon each single request.
>>
>> Is there any way to test my application using the Jersey Test Framework? I haven’t found any possibility to have control over sessions and cookies.
>>
>> Best regards,
>> Christof
>