diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java index 7ce8374ec9ba91f4c40d56035dd2f3d8c0e61fb1..562bbfca30d71472b315dde6ce40f6ff6caaf246 100644 --- a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java +++ b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java @@ -48,7 +48,7 @@ class VetController { return "vets/vetList"; } - @GetMapping({ "/vets.json", "/vets.xml" }) + @GetMapping({ "/vets" }) public @ResponseBody Vets showResourcesVetList() { // Here we are returning an object of type 'Vets' rather than a collection of Vet // objects so it is simpler for JSon/Object mapping diff --git a/src/main/resources/templates/vets/vetList.html b/src/main/resources/templates/vets/vetList.html index 842411ecdaabcf52a30f98d2b1c75463436dd0f8..4c1c1c9f32043e453fee64de86e6ecf36b4ca22e 100644 --- a/src/main/resources/templates/vets/vetList.html +++ b/src/main/resources/templates/vets/vetList.html @@ -26,8 +26,7 @@ <table class="table-buttons"> <tr> - <td><a th:href="@{/vets.xml}">View as XML</a></td> - <td><a th:href="@{/vets.json}">View as JSON</a></td> + <td><a th:href="@{/vets}">View as XML</a></td> </tr> </table> diff --git a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java index ce6adf8e0cd73368260db2e5a5ee2c6c259805d3..bc3b6c0a7ad08adc3894627be233468f57609f65 100644 --- a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java @@ -65,7 +65,7 @@ public class VetControllerTests { @Test public void testShowResourcesVetList() throws Exception { - ResultActions actions = mockMvc.perform(get("/vets.json").accept(MediaType.APPLICATION_JSON)) + ResultActions actions = mockMvc.perform(get("/vets").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); actions.andExpect(content().contentType("application/json;charset=UTF-8")) .andExpect(jsonPath("$.vetList[0].id").value(1)); @@ -73,7 +73,7 @@ public class VetControllerTests { @Test public void testShowVetListXml() throws Exception { - mockMvc.perform(get("/vets.xml").accept(MediaType.APPLICATION_XML)) + mockMvc.perform(get("/vets").accept(MediaType.APPLICATION_XML)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_XML_VALUE)) .andExpect(content().node(hasXPath("/vets/vetList[id=1]/id")));