dev@jersey.java.net

Re: WebApplicationException alternative suggestion

From: Adam Walczak <ja_at_adamwalczak.info>
Date: Wed, 24 Nov 2010 13:14:42 +0100

> How do you propose to serialize out the Throwable as XML or JSON?

I think it should be configurable so that we can decide if we want
xml, json oraz plain text.

With plain text only the localizedMessage would be printed.

xml and json should be printed with JAXB with some default rules for
printing Throwabe.

Not JAXB annotated exceptions should look like this:

{
  class: "SomeException",
  superclasses: [
    "SomeSuperException",
    "SomeSuperSuperException"
  ],
  message: "Sdsfd sdfds dsf",
  localizedMessage: "Dsfdsfsd dsfds sdf"
}

JAXB annotated should at least have the above and more.

Still got to try if this type of behaviour is easy to implement in the
JAXB implementation that Jersey is using.

But do you think the concept seams ok ?

-- 
Adam Walczak
www.adamwalczak.info
+48 604 188 992