users@jersey.java.net

Jersey client can't handle an empty response

From: Mike Baranczak <mbaranczak_at_gmail.com>
Date: Wed, 4 Aug 2010 10:40:50 -0400

I'm using Jersey 1.1.5 inside Glassfish 3. I have a resource method
that returns a collection object, but sometimes it returns null; this
is the desired behavior, it just indicates that it has no data to
send. The Jersey server deals with this by sending a response with an
empty body and a status of "204 No Content". So far so good - but the
Jersey client throws a UniformInterfaceException when it's expecting
some data in the response and gets a 204 instead.

Should this be considered a bug in the Jersey client?

Is there any way to work around this (I don't want to send an empty
non-null collection, since within my application this would mean
something different than a null response)?

-MB