I need to know if there is a way by which I can set the @Produces value from query parameter. For example: if the query parameter value is 'JSON' then I want to set the method header as @Produces(application/json) or if it is 'XML' then I want to set it as @Produces(application/xml)
I know that we can specify multiple media types as @Produces({"application/json", "application/xml"}), but it is not working for me as it is giving me an error when the output is JSON.
Many thanks!