I have a method resembling the following:

@Path("/testBoolean")
@GET
public String getString(@QueryParam("value") Boolean value) {
    if (value != null) {
        return Boolean.toString(value);
    } else {
        return "No value";
    }
}

When I call this service with:
http://localhost:8080/test-rest/test/testBoolean

I receive the String "No Value" as the response (as expected).

However, when calling this service with either of the following two URLS:
http://localhost:8080/test-rest/test/testBoolean?value=true
http://localhost:8080/test-rest/test/testBoolean?value=1

I receive an XMLFault indicating "java.lang.IllegalArgumentException:
argument type mismatch".

What (if any) is the appropriate way (using JAX-RS) to pass a boolean type
argument as a QueryParam?  I realize that I could change the type to String,
but that would dirty my APIs for non-Rest clients.

I can't find anything in the JSR-311 specification, or the CXF documentation
discussing this.

Thanks - 
Steve Ardis

-- 
View this message in context: 
http://www.nabble.com/JAX-RS-Boolean-Parameter-Type-tp16825382p16825382.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to