1.

Can @produces Annotation Be Overridden In A Restless Resource? Give Example?

Answer»

Yes. In the following example, the default MIME type is set as text/plain but doGetAsHtml method overrides it to text/html. 

@Path("/testResource") 
@PRODUCES("text/plain") 
PUBLIC class TestResource { 
@GET 
public STRING doGetAsPlainText() { 
... 

 
@GET 
@Produces("text/html") 
public String doGetAsHtml() { 
... 

Yes. In the following example, the default MIME type is set as text/plain but doGetAsHtml method overrides it to text/html. 

@Path("/testResource") 
@Produces("text/plain") 
public class TestResource { 
@GET 
public String doGetAsPlainText() { 
... 

 
@GET 
@Produces("text/html") 
public String doGetAsHtml() { 
... 



Discussion

No Comment Found