Session Handling not working with Jersey Client

From: <>
Date: Fri, 05 Feb 2010 13:38:11 +0100


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:

public String createReport(...,_at_Context HttpServletRequest req) {" SessionID is :" + req.getSession().getId());

Any ideas what's wrong?

Normal JSP Session Handling works fine.

I use tomcat 6.0.20, jdk and jersey 1.0.3

Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher!