osgi-jax-rs-connector
osgi-jax-rs-connector copied to clipboard
Consumer cannot handle void methods and null returns
Hey,
We're using the consumer (only the consumer) in our application. We have a GET method that might return null, and a POST method that returns void. Both cases don't work, as the ResourceInvocationHandler does not distinguish between response 200 and 204 (No Content) - which is the response in both cases. Calling readEntity when the response is 204 results in an exception.
Server is Jetty with Jersey.
IMHO the "response.readEntity( method.getReturnType() );" should be something like
if(response.getStatus() == 200) { response.readEntity( method.getReturnType() ); } else { return null; }
or something similar.