Page 1 of 1

About Question enthuware.ocejws.v6.2.288 :

Posted: Thu Apr 17, 2014 10:02 am
by himaiMinh
Regarding to this explanation, "you can easily create two new methods in the current JAX-RS resource by adding @Produces annotations."
I think there is another alternative, which is content negotiation:

Code: Select all

  // an example to convert a JAXBSource into XML/JSON/text
   @Produce({"application\xml", "application\json", "text\plain", "text\html"})
     public JAXBSource getResult(){
                ....
     }

Re: About Question enthuware.ocejws.v6.2.288 :

Posted: Fri Apr 18, 2014 2:24 am
by fjwalraven
Both are examples of static content negotiation. With the latter option according to the Accept header you will get the right content back. The implementation of which content to send back to the client is then put in the MessageBodyReader and MessageBodyWriter instead of the web service method implementation.

If I add this example it will add extra complexity to the explanation.

Regards,
Frits