users@jersey.java.net

MediaType Delegate is null.

From: Tom Barber <tom_at_wamonline.org.uk>
Date: Sun, 19 Sep 2010 21:54:35 +0100

Hi Guys,

I'm trying to create a jersey client osgi bundle for use in Apache Sling.

My code is pretty straightforward

  r = client.resource("http://localhost:8888/dependencyApp/rest/admin/session");
       Builder test = r.accept(MediaType.APPLICATION_JSON);
       ClientResponse response = test.post(ClientResponse.class);
       return response.getEntity(SessionObject.class);

But when I try to get the entity I the delegate variable in MediaType is always null so the valueOf call fails.

I've searched around, and I saw that previously you may have had to include the jersey-server package as well so I did that. Both client and server are 1.4 but I always get an NPE for the delegate.

Any pointers?

Thanks

Tom