users@jax-rs-spec.java.net

[jax-rs-spec users] New constructor in WebApplicationException

From: Ryan de Laplante (Private) <"Ryan>
Date: Sun, 11 Nov 2012 21:59:32 -0500

I would like to do the equivalent of the following C# code:

throw new WebFaultException<string>("The SampleItem returned wasn't
correctly formatted.",
                                                   
HttpStatusCode.BadRequest);

However, JAX-RS' WebApplicationException requires a Throwable so my code
would look like this:

throw new WebApplicationException(new IllegalArgumentException("The
SampleItem returned wasn't correctly formatted."),
                                                     Status.BAD_REQUEST);


It would be nice if JAX-RS supported a similar constructor:

http://msdn.microsoft.com/en-us/library/dd989852.aspx


Thanks,
Ryan