REST. Jersey. How to programmatically choose what type to return: JSON or XML?

Kanmorph

New Member
I have 2 questions: 1. Can I create one class, annotate it with JAXB annotations(for XML support) and declare in \[code\]web.xml\[/code\] \[code\]<init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value></init-param>\[/code\]for JSON (Jackson library) support? Or I need to create separately two classes for JSON and XML? Or may be exist some more elegant way to cause REST service to return both JSON and XML?2. How I can programmatically choose what type to return (JSON or XML)? Thanks.
 
Back
Top