I have configured spring to resolve xml and json responses for our API as follows:
<!-- oxm integration -->
<bean id="objectXmlMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="ignoreAcceptHeader" value="false" />
<property name="favorPathExtension" value="true" />
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml" />
<entry key="json" value="application/json" />
</map>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
<property name="marshaller" ref="objectXmlMarshaller" />
</bean>
</list>
</property>
</bean>
Unfortunately, spring returns xml responses with application/*+xml. It seems that chrome is not able to open such extensions and sends it to windows to open them (so rather than seeing the response on the browser, I have to open it via windows).
Does anyone know why it is returning application/*+xml instead of the configured application/xml?
If not, anyone know how to force chrome to display it?
Thanks!
The only way I found of solving this was to directly map the controller with the required:
Too bad spring does not allow you to have a global definition.