users@jersey.java.net

[Jersey] Premature EOF on clientResponse.getEntity()

From: Pascal Huynh <pascal.huynh_at_novapost.fr>
Date: Tue, 2 Aug 2011 18:44:05 +0200

Hello all,

I'm stuck on a problem with the use of the jersey client API and I don't
find any helpfull tip on the web.
Here my problem :

I've a simple resource producing json :

@Path("/myresource")
@Produces(MediaType.APPLICATION_JSON)
public class MyResource {

    @GET
    @Path("/documents/info")
    public String getInfo() {
        return "Something";
    }
}


and simple client requesting this resource :

public String getInfo() {
        WebResource resource = client.resource(serviceUrl +
"/documents/info");
        return resource.get(String.class);
}

This cause an IOexception ; Premature EOF

I feel really stupid with code as simple but I can not find any solution.
(using a ClientResponse instance goes same way).

Any help would be very appreciated!!

Thanks a lot