users@jersey.java.net

[Jersey] Re: Message Body Writer

From: Rimy Sfm <atitallah.rim_at_gmail.com>
Date: Wed, 13 Apr 2011 05:56:34 -0700 (PDT)

I'm sorry I posted a wrong method declaration. Actually the method causin me
the problem takes 2 integer as paramerter:


        @Path("/addInt")
        @POST
        public Integer add(@FormParam("a") Integer a, @FormParam("b")Integer b)
        {
                return a+b;
        }


and this is the part of my client code whre I invoke it:


                                MultivaluedMapImpl formDataInt = new MultivaluedMapImpl();
                                  
                                        formDataInt.add("a", 2);
                                        formDataInt.add("b", 3);
                                        ClientResponse responseInt =
service.path("hello/addInt").post(ClientResponse.class,formDataInt);
                                        String entityInt = responseInt.getEntity(String.class);
                                        System.out.println (responseInt);
                                        System.out.println (entityInt);
              
        }

And when I run my server I get this error:

GRAVE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A
message body writer for Java class java.lang.Integer, and Java type class
java.lang.Integer, and MIME media type application/octet-stream was not
found




--
View this message in context: http://jersey.576304.n2.nabble.com/Message-Body-Writer-tp6268231p6268855.html
Sent from the Jersey mailing list archive at Nabble.com.