users@jersey.java.net

Session Handling not working with Jersey Client

From: <Peter.Neu_at_gmx.net>
Date: Fri, 05 Feb 2010 13:38:11 +0100

Hi,

I have trouble with the session handling with the jersey client. Each call I make to the jersey server produces a new session id. Thus I'm not able to store anything in the session.

My calls look like this:
                
WebResource resource = restClient.resource(url + "fileupload");
Builder builder = resource.type("application/x-www-form-urlencoded");
builder = builder.header("Authorization", "...))));
builder = builder.accept("application/json");
builder = builder.header("Accept-Charset", "UTF-8");
final MultivaluedMap<String, String> formParams = new MultivaluedMapImpl();
formParams.add("..", "...");
formParams.add("..", "...");

In my rest method on the server I have:

@POST
@Path("/createreport")
@Produces(MediaType.APPLICATION_JSON)
@Consumes("application/x-www-form-urlencoded")
public String createReport(...,_at_Context HttpServletRequest req) {

logger.info(" SessionID is :" + req.getSession().getId());
}

Any ideas what's wrong?

Normal JSP Session Handling works fine.

I use tomcat 6.0.20, jdk 1.6.0.11 and jersey 1.0.3

Cheers,
Pete
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser