How to reuse Jersey's JSON/JAXB for serialization?

前端 未结 7 1337
失恋的感觉
失恋的感觉 2020-11-29 23:48

I have a JAX-RS REST service implemented using Jersey. One of the cool features of JAX-RS/Jersey is how easily a POJO can be turned into a REST service, simply by sprinkling

7条回答
  •  抹茶落季
    2020-11-30 00:30

    I understand XML views but it would have shown some foresight to require JSON support for POJOs as standard equipment. Having to doctor up JSON identifiers with special characters makes no sense if your implementation is JSON and your client is a JavaScript RIA.

    Also, not that Java Beans are NOT POJOs. I would like to use something like this on the outer surface of my web tier:

    public class Model
    {
       @Property height;
       @Property weight;
       @Property age;
    }
    

    No default constructor, no getter/setter noise, just a POJO with my own annotations.

提交回复
热议问题