MediaType of REST

Posted by user357243 on Stack Overflow See other posts from Stack Overflow or by user357243
Published on 2010-06-03T08:41:23Z Indexed on 2010/06/03 8:44 UTC
Read the original article Hit count: 139

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about rest