users@jersey.java.net

[Jersey] Re: How to use _at_PerSession without cookies

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Tue, 24 May 2011 17:09:21 +0200

Hi Uwe,

You will probably need to allow URL rewriting on Tomcat
and also to use HttpServletResponse.encodeURL method
to get the jsession parameter to the URLs, which you send
from the server to the client to get the session information
preserved there. You should be able to inject the HttpServletResponse
instance to your resource using @javax.ws.rs.core.Context annotation.

However, if you could design your resources so that you
do not rely on the Servlet sessions, then it should be better.

HTH,

~Jakub


On 02/23/2011 04:15 PM, reh_at_hebis.uni-frankfurt.de wrote:
> If the client accepts cookies, @PerSession does its job well and jersey
> creates one instance per session.
> If the client, does not accept any cookies, jersey is loosing the
> session and creates a new instance for each request.
>
> Is it possible, to track the jsession as fallback in the URL?
>
> I'm using the jersey-bundle-1.5 in a Tomcat 6 environment.
>
> Uwe
>