Configuring content-negotiation (JSON, XML, and so on)
In this recipe, we will see how to configure the way we want the system to decide which format to render depending upon the client expectations.
We are mostly going to review the XML configuration here. Then, we will test the API with different requests to ensure support is provided to the XML format.
How to do it...
RequestMappingHandlerAdapterconfiguration has been altered in
contentNegotiationManagerproperty has been added, as well as an
<bean class="org.sfw.web... method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> <list> <ref bean="xmlConverter"/> <ref bean="jsonConverter"/> </list> </property> ...