List of usage examples for org.springframework.http.converter.xml MarshallingHttpMessageConverter MarshallingHttpMessageConverter
public MarshallingHttpMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller)
From source file:org.springframework.social.soundcloud.api.impl.SoundCloudTemplate.java
@Override protected List<HttpMessageConverter<?>> getMessageConverters() { List<HttpMessageConverter<?>> messageConverters = super.getMessageConverters(); messageConverters.add(new ByteArrayHttpMessageConverter()); XStreamMarshaller marshaller = new XStreamMarshaller(); Map<Class<?>, String> implicitCollections = new HashMap<Class<?>, String>(); implicitCollections.put(TrackArray.class, "tracks"); marshaller.setImplicitCollections(implicitCollections); // marshaller.setConverters(converterMatchers); Map<String, Object> aliases = new HashMap<String, Object>(); aliases.put("playlist", XmlPlaylistUpdate.class.getName()); // aliases.put("playlist", PlaylistUpdate.class.getName()); aliases.put("track", TrackReference.class.getName()); Map<String, Class<?>> useAttributeFor = new HashMap<String, Class<?>>(); useAttributeFor.put("type", String.class); try {//from w w w . ja v a 2s . com marshaller.setAliases(aliases); marshaller.setUseAttributeFor(useAttributeFor); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } messageConverters.add(new MarshallingHttpMessageConverter(marshaller, marshaller)); return messageConverters; }
From source file:org.bremersee.common.spring.autoconfigure.WebMvcConfiguration.java
@Bean @Primary public MarshallingHttpMessageConverter marshallingHttpMessageConverter() { return new MarshallingHttpMessageConverter(jaxbMarshaller, jaxbMarshaller); }