I'm writing a Controller
to replace a legacy system which serves an xml document - but the url has a .html
extension
My controller looks like this
@RequestMapping(value="/{name}.html",
method = RequestMethod.GET,
consumes = MediaType.ALL_VALUE,
produces = MediaType.APPLICATION_XML_VALUE)
public @ResponseBody XmlContent getContent(@PathVariable(value = "name") String name) {
return service.getXmlContent();
}
When I try and hit the URL I get a 406 error:
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
If I change the request mapping to be .xml
it all works fine. Is there a component that I need to disable - something that's intercepting the .html
part of the request and refusing to map it to xml?