users@jersey.java.net

[Jersey] Re: Premature EOF on clientResponse.getEntity()

From: Srinivas Naresh Bhimisetty <shri.naresh_at_gmail.com>
Date: Wed, 3 Aug 2011 14:18:51 +0530

What happens when you hit the URL through the browser or through the curl
command with the appropriate *Accept *header?

- Naresh

On Tue, Aug 2, 2011 at 10:14 PM, Pascal Huynh <pascal.huynh_at_novapost.fr>wrote:

> 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
>
>