users@jersey.java.net

Re: IRC Chat: Paul Sandoz and Frank Martinez (Declarative Security, Injectables) Fragment.

From: Frank Martínez <mnesarco_at_gmail.com>
Date: Thu, 10 Apr 2008 13:09:42 -0500

Hi Jakub,

On Wed, Apr 9, 2008 at 4:51 PM, Jakub Podlesak <Jakub.Podlesak_at_sun.com> wrote:
>
> Hi Frank,
>
>
> On Wed, Apr 09, 2008 at 11:39:38AM -0500, Frank Martínez wrote:
> > (10:19:25 AM) FrankMartinez: But i have had to write my own JSON writer.
> > (10:19:57 AM) PaulSandoz: Yes, this is an area we are still finding
> > our feet with, i hoped the JAXB approach would be OK but i think we
> > need to get more into the JAXB model to improve it
> > (10:20:27 AM) FrankMartinez: Yes
> > (10:20:50 AM) FrankMartinez: Now i am working in a declarative security ...
> > (10:21:28 AM) PaulSandoz: re: Json can you provide some feedback (did
> > you already?) what what form of JSon you would like and if using beans
> > what would work for you?
> > (10:24:08 AM) FrankMartinez: I used a free lib called json-lib, then i
> > wrote a MessageBodyWriter ... thats all.
>
> At the JAXB->JSON approach: was the only issue the one-elem array thing?
> Or is there something else to improve/change?
>

one-element array and generic collection in generic classes like this:

class XXX<T> {
  private List<T> yyy;
}

> Besides JAXB beans (@XmlRootElement annotated POJOs) related readers/writers
> there were some other approaches considered/discussed as well:
>
> i) POJO<->JSON readers/writers (maybe POJOs with JSON specific annotations
> (json-lib way))
> ii) POJO<->JSON readers/writers when serialization/deserialization is being done
> via JAXB->JSON mapping (current mechanism) leveraging the possibility
> in JAXB2 to marshal/unmarshall raw (unannotated) POJO by wrapping
> it with JAXBElement object.
>
> Do you think that one of them should be somehow included in Jersey?
>
> What do others think?
>

I prefer the option (i) but supporting unannotated POJOs too.
So you can have a POJO with JAXB annotations but it will be serialized
via JAXB only if the ProduceMime is application/xml. It is serialized
via JSON reader/writer if ProduceMime is application/json.

> Thanks,
>
> ~Jakub
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>

Cheers,
Frank.

-- 
Frank D. Martínez M.
Asimov Technologies Ltda.
Blog: http://www.ibstaff.net/fmartinez/