Question

i've got a big problem by using a REST setup. Returning of complex types is working fine, but i'm not able to return primitive types:

@GET
@Path("/testbool")
@Produces(MediaType.APPLICATION_XML)
public Boolean testbool(){
    return false;
}

@GET
@Path("/testbool")
@Produces(MediaType.APPLICATION_XML)
public boolean testbool(){
    return false;
}

doesn't work, because i get an exception:

Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class java.lang.Boolean, and Java type class java.lang.Boolean, and MIME media type application/xml was not found

is there an easy way to fix this? - i already googled for it, but i was not able to find an easy solution without writing a wrapper or implementing the bodywriter by myself... But i cannot imagine that such a simple thing isn't included..

thanks for your help!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top