-
Notifications
You must be signed in to change notification settings - Fork 561
Description
Petar Tahchiev opened DATAREST-1235 and commented
Hello,
I want to get the response from Spring Data REST in XML or CSV or some other format. For that reason Spring Data REST allows me to register some extra HttpMessageConverters in my RepositoryRestConfigurerAdapter like this:
@Override
public void configureHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
super.configureHttpMessageConverters(messageConverters);
messageConverters.add(new MappingJackson2XmlHttpMessageConverter());
messageConverters.add(new MappingJackson2CborHttpMessageConverter());
messageConverters.add(new MappingJackson2SmileHttpMessageConverter());
messageConverters.add(new CsvHttpMessageConverter());
}but seems like they are not used at all.
However even though I specify correct Accept header I get 406 (Not Acceptable).
I found out that RepositoryRestHandlerMapping sets some fallback media types if the RepositoryEntityController has not specified what the methods produce.
If I comment out the 2 lines (just like I have done in this pull request):
https://github.com/spring-projects/spring-data-rest/pull/292/files
then it all seems to work fine - I can get XML/CSV or whatever I specify in the Accept header. Also if I don't specify Accept header I get the JSON back. So i'm not sure what the two lines are for, but to me it seems they are not needed.
Affects: 3.0.6 (Kay SR6)