minor configuration work

This commit is contained in:
eugenp 2014-01-10 13:49:11 +02:00
parent 72edb72fd5
commit 0f8409bf7d
1 changed files with 7 additions and 8 deletions

View File

@ -20,25 +20,24 @@ public class WebConfig extends WebMvcConfigurerAdapter {
super(); super();
} }
// API //
@Override @Override
public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) { public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) {
messageConverters.add(marshallingHttpMessageConverter()); messageConverters.add(createXmlHttpMessageConverter());
messageConverters.add(new MappingJackson2HttpMessageConverter()); messageConverters.add(new MappingJackson2HttpMessageConverter());
super.configureMessageConverters(messageConverters); super.configureMessageConverters(messageConverters);
} }
// UTIL private HttpMessageConverter<Object> createXmlHttpMessageConverter() {
final MarshallingHttpMessageConverter xmlConverter = new MarshallingHttpMessageConverter();
private final MarshallingHttpMessageConverter marshallingHttpMessageConverter() {
final MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter();
final XStreamMarshaller xstreamMarshaller = new XStreamMarshaller(); final XStreamMarshaller xstreamMarshaller = new XStreamMarshaller();
marshallingHttpMessageConverter.setMarshaller(xstreamMarshaller); xmlConverter.setMarshaller(xstreamMarshaller);
marshallingHttpMessageConverter.setUnmarshaller(xstreamMarshaller); xmlConverter.setUnmarshaller(xstreamMarshaller);
return marshallingHttpMessageConverter; return xmlConverter;
} }
} }