MediaType of REST
- by user357243
Hi, I am beginner in REST web services.
I wrote a program of REST to display the HTML or XML. The @Path annotation's value is @Path("{typeDocument}"). There are two methods for GET :
@GET
@Produces(MediaType.TEXT_XML)
public String getXml(@PathParam("typeDocument") String typeDocument)
to display XML file,
and
@GET
@Produces(MediaType.TEXT_HTML)
public String getHtml(@PathParam("typeDocument") String typeDocument)
to display HTML.
The browser Firefox always excutes getHtml() when URL is either http://localhost:8080/sources/html or localhost:8080/sources/xml
But IE always excutes getXml().
How to excute the correct method, as defined by URL, in different browser ? Thanks a lot.