hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Consumer cannot handle void methods and null returns #165

Open mduft opened 8 years ago

mduft commented 8 years ago

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.