users@jersey.java.net

Re: boolean return values in a json mime type

From: Arul Dhesiaseelan <arul_at_fluxcorp.com>
Date: Tue, 22 Apr 2008 13:43:37 -0600

Arul Dhesiaseelan wrote:
> Hello,
>
> I have the following rest method which returns a boolean json response.
>
> @GET @Path("/isValid/{id}")
> @ProduceMime({"application/json"})
> public boolean isValid(@PathParam("id") String id) {
> return true;
> }
>
> But, it fails with the following error.
>
> SEVERE: A message body writer for Java type, class java.lang.Boolean,
> and MIME m
> edia type, application/json, was not found
>
> Am I missing any jars specific to this error? I have jettison in my
> classpath.
>
> Thank you
> Arul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
> _________________________________________________
> Scanned by MessageLabs for the Super Flux Friends
> _________________________________________________
I was able to fix this just by changing the return type as below.

 @GET @Path("/isValid/{id}")
 @ProduceMime({"application/json"})
 public String isValid(@PathParam("id") String id) {
   return new Boolean(true).toString();
 }