|
From: Bill B. <bb...@re...> - 2008-07-09 12:36:19
|
:(
You'll have to wrap your own provider. I brought up this issue of
wrapped exceptions in the EG and we're addressing it, although you'll
still have to write a provider even with that solution...
However, I should probably have some good EJB integration and have a
ExceptionMapper for EJBException...
Adam Jordens wrote:
> Here’s the situation.
>
> I’ve got a resource implemented as a Stateless EJB (/exposed via a Seam
> application but that’s neither here nor there/).
>
> @Stateless
> @Local(SpecimensClient.class)
> @Name("specimens")
> @Path("/rest/specimens")
> public class SpecimensBean implements SpecimensClient, Serializable
> {
> public ExtSpecimen getSpecimen(Long id)
> {
> try
> {
> Specimen specimen = (Specimen)
> em.createQuery("XYZ").getSingleResult();
>
> ...
> return extSpecimen;
> }
> catch (NoResultException e)
> {
> throw new
> WebApplicationException(HttpURLConnection.HTTP_NOT_FOUND);
> }
> }
> }
>
> Now accessing that resource with an invalid id is resulting in the
> WebApplicationException getting thrown. However instead of it
> propagating up as a InvocationTargetException with the
> WebApplicationException as it’s cause, the InvocationTargetException is
> wrapping an EJBException which in turn is wrapping the
> WebApplicationException.
>
> What’s the opinion on the best way to handle this, short of having to
> implement a @Provider to do the unwrapping of the EJBException myself
> (/which does seem to work/).
>
>
> Kind Regards,
> Adam
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|