How to serialize Java primitives using Jersey REST

前端 未结 6 1973
灰色年华
灰色年华 2020-11-29 11:47

In my application I use Jersey REST to serialize complex objects. This works quite fine. But there are a few method which simply return an int or boolean.

Jersey can

6条回答
  •  我在风中等你
    2020-11-29 12:21

    Are you writing a service or a client? In the service-end of things, you would simply write a MessageBodyWriter to serialize a stream of data to a Java object for your types. In my use cases, the services I'm writing output to JSON or XML, and in XML's case, I just throw one JAXB annotation on the top of my classes and I'm done.

    Have you looked at the Jersey User guide regarding this?

    3.6. Adding support for new representations

提交回复
热议问题