Java – how to set JSON instead of XML in Jersey?

Use Jersey java. Net if no title or is accepted in the URI How to set JSON to default serialization instead of XML when using XML suffixes?

Solution

You can specify quality indicators for each media type in the @ produces note If XML and JSON are allowed, you can do the following to make Jersey prefer JSON:

@Produces({"application/json;qs=1","application/xml;qs=.5"})
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>