I started using WebApplicationException and the Response object
following your advice:
@GET
@ProduceMime("application/json")
public JSONObject getMyObject(
throw new javax.ws.rs.WebApplicationException(
javax.ws.rs.core.Response.status(403).entity("Missing
permissions at ...").type("text/plain").build()
);
);
But I found that this exception that I just want to propagate to the
user still gets propagated to the web container and logged.
This is not an exception that got unhandled but an exception I just
want propagated to the WebService user.
I am doing something wrong or should Jersey not propagate
WebApplicationException to the Web Container?
Or maybe I should always return Response (instead of JSONObject) if my
web service may not return data because of an error or missing
authorization?