dev@jersey.java.net

Re: WebApplicationException alternative suggestion

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 2 Dec 2010 14:04:42 +0100

On Nov 25, 2010, at 7:01 PM, Adam Walczak wrote:

>> So you are suggesting the exception class should also be annotated
>> with JAXB
>> annotations?
>
> I think that there should be a default set of rules on serializing
> exceptions to xml/json which can be overwritten by using JAXB. But
> JAXB it self is not mandatory in this solution.
>
>> In general yes, but i think it would be useful to merge where
>> appropriate
>> Alexandru's ideas.
>
> Ok. I'll email Alexandru if he could give me some code sample of his
> solution.
>
> BTW. Personally I dislike the FormBuilder sample. I use JAX-RS mostly
> for EJB's that are not just used by the web front-end and a form is
> something web-specific.
>

I don't think it has to be. Although the mediatype application/x-www-
form-urlencoded is defined in the HTML specification i have found it
to be really useful outside the context of HTML forms. It is a highly
interoperable solution for exchanging simple name/value pairs.

If not using HTML what will tend to be missed is some hypermedia in
the representation to define how a client can POST/PUT such
information. FWIW the RESTful GlassFish admin service defines it's own
meta-data for such cases. WADL can also describe forms, but i think we
could improve that aspect.

Paul.