Am I able to change the value of @Produces annotation parameter in my RESTEasy services??
The task I'm given is to integrate multiple format reporting to an existing reporting system.
So changing the @Produces annotation parameter dynamically would help me a lot.
Thanks in advance!
Make your method return a Response
object and try something like this;
int status = 200;
String type = MediaType.APPLICATION_XML;
String response = "<hello>world</hello>";
return Response.status(status).type(type).entity(response).build();
I think the type in the response will override what you annotated, but I haven't tested it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With