osgi-jax-rs-connector icon indicating copy to clipboard operation
osgi-jax-rs-connector copied to clipboard

Consumer cannot handle void methods and null returns

Open mduft opened this issue 8 years ago • 0 comments

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.

mduft avatar Jun 22 '16 09:06 mduft