Just doing a little comparison with spring and jersey.
Curious if it is possible for a method to return both xml or json.
Maybe default to xml, but have an optional flag that will return json.
Possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You mention Jersey, so I assume you are referring to a REST implementation. Jersey will automatically serialize your content as XML and JSON if your resource is properly setup. You just have to indicate a wider range of media types for your
@Producesannotations:Where
MyBeanis an appropriately JAXB annotated POJO. With this resource endpoint definition a caller can specify what content type they want via theAccept:header: