From: Bill B. <bb...@re...> - 2012-08-16 13:33:49
|
On 8/16/2012 9:11 AM, Winterer Mario wrote: > Hi! > > An IllegalArgumentException - similar to a NullPointerException - always denotes a programmer's error (or at least it should), so a client error response 500 - Internal Server Error is correct. As an invalid URL is not a programmer's error (maybe an error of the client programmer, but that's another story), an IllegalArgumentException should not be used for that purpose. > > In your case, you probably better throw a WebApplicationException with a client error response 400. > > Note: The new JAX-RS 2.0 specification (available as early draft) already defines a ClientErrorException as a subclass of WebApplicationException for exactly that purpose - but I don't think, RESTeasy already supports JAX-RS 2.0 yet. > For JAX-RS 2.0, There's going to be an exception hierarchy for error conditations that can be used on the server and will be used on the client. But, JAX-RS 2.0 is not even in public draft phase (sometime September). We plan on having an alpha release of JAX-RS 2.0 sometime before or after the public draft release plus/minus a few weeks. Check out master branch to see how far we are implementing it. I commit something new 1-2 times a week. Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |