users@jersey.java.net

[Jersey] Selecting ExceptionMappers and MIME types

From: Ryan Stewart <zzantozz_at_gmail.com>
Date: Wed, 26 Jan 2011 18:02:43 -0600

In the past 24 hours, I've run into behavior in Jersey 1.2 that seems
indeterminate in two unrelated areas: selecting an ExceptionMapper and
selecting a MIME type for sending a request (using the Jersey client).

1) If you have two ExceptionMappers registered for the same exception type,
Jersey seems to arbitrarily choose one. It seems that this scenario should
at least always pick the same mapper or maybe just throw an exception if
there are multiple matches.

2) If client code doesn't specify a mime type, it seems, again, to randomly
pick one that's available--meaning one that it can marshal to based on its
available dependencies. Again, it seems the client code should either have a
stated default that it always uses or maybe throw an exception if no type is
specified.

I haven't checked newer versions of Jersey. Would upgrading cover any of
this?