List of usage examples for org.springframework.http.converter.xml SourceHttpMessageConverter SourceHttpMessageConverter
public SourceHttpMessageConverter()
From source file:com.vgorcinschi.concordiafootballmanager.rest.RestServletContextConfiguration.java
@Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { converters.add(new SourceHttpMessageConverter<>()); MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); jsonConverter.setSupportedMediaTypes( Arrays.asList(new MediaType("application", "json"), new MediaType("text", "json"))); jsonConverter.setObjectMapper(mapper().getObject().setSerializationInclusion(JsonInclude.Include.NON_NULL)); converters.add(jsonConverter);//from w ww .j a v a2 s.co m }
From source file:org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.java
public AllEncompassingFormHttpMessageConverter() { addPartConverter(new SourceHttpMessageConverter()); if (jackson2Present) { addPartConverter(new MappingJackson2HttpMessageConverter()); } else if (gsonPresent) { addPartConverter(new GsonHttpMessageConverter()); }/*from w w w .j av a 2 s. c o m*/ }
From source file:org.craftercms.search.service.impl.RestClientSearchService.java
public RestClientSearchService() { restTemplate = new RestTemplate(); List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); messageConverters.add(new ByteArrayHttpMessageConverter()); StringHttpMessageConverterExtended stringHttpMessageConverter = new StringHttpMessageConverterExtended( Charset.forName(CharEncoding.UTF_8)); messageConverters.add(stringHttpMessageConverter); messageConverters.add(new FormHttpMessageConverter()); messageConverters.add(new ResourceHttpMessageConverter()); messageConverters.add(new SourceHttpMessageConverter()); messageConverters.add(new XmlAwareFormHttpMessageConverter()); if (jaxb2Present) { messageConverters.add(new Jaxb2RootElementHttpMessageConverter()); }// w w w. j a va 2 s .c om if (jacksonPresent) { messageConverters.add(new MappingJacksonHttpMessageConverter()); } if (romePresent) { messageConverters.add(new AtomFeedHttpMessageConverter()); messageConverters.add(new RssChannelHttpMessageConverter()); } restTemplate.setMessageConverters(messageConverters); }
From source file:com.wiiyaya.consumer.web.initializer.config.WebConfig.java
/** * ???/*from w w w. j a v a2 s . c o m*/ */ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(ConfigConstant.SYSTEM_CHARSET); stringConverter.setWriteAcceptCharset(false); converters.add(new ByteArrayHttpMessageConverter()); converters.add(stringConverter); converters.add(new ResourceHttpMessageConverter()); converters.add(new SourceHttpMessageConverter<Source>()); converters.add(new AllEncompassingFormHttpMessageConverter()); converters.add(new Jaxb2RootElementHttpMessageConverter()); MappingJackson2HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter(); ObjectMapper om = jacksonConverter.getObjectMapper(); om.setDateFormat(new SimpleDateFormat(ConfigConstant.SYSTEM_DATE_FORMAT)); om.setLocale(ConfigConstant.SYSTEM_LOCALE); om.setTimeZone(TimeZone.getTimeZone(ConfigConstant.SYSTEM_TIME_ZONE)); om.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() { @Override public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeString(StringUtils.EMPTY); } }); om.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true); om.configure(Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); List<MediaType> mediaTypeList = new ArrayList<MediaType>(); mediaTypeList.add(new MediaType("text", "plain", ConfigConstant.SYSTEM_CHARSET)); jacksonConverter.setSupportedMediaTypes(mediaTypeList); converters.add(jacksonConverter); }
From source file:morph.plugin.views.annotation.AnnotationMethodHandlerAdapter.java
@SuppressWarnings("rawtypes") public AnnotationMethodHandlerAdapter() { // no restriction of HTTP methods by default super(false); // See SPR-7316 StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); this.messageConverters = new HttpMessageConverter[] { new ByteArrayHttpMessageConverter(), stringHttpMessageConverter, new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter() }; }
From source file:co.paralleluniverse.springframework.web.servlet.mvc.method.annotation.FiberRequestMappingHandlerAdapter.java
/** * Default constructor.//from www.j a v a 2s.c o m */ public FiberRequestMappingHandlerAdapter() { StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316 this.messageConverters = new ArrayList<>(); this.messageConverters.add(new ByteArrayHttpMessageConverter()); this.messageConverters.add(stringHttpMessageConverter); this.messageConverters.add(new SourceHttpMessageConverter<>()); this.messageConverters.add(new AllEncompassingFormHttpMessageConverter()); }
From source file:org.springframework.data.document.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.java
public AnnotationMethodHandlerAdapter() { // no restriction of HTTP methods by default // MLP//from ww w. j a v a 2 s .co m super(false); // See SPR-7316 StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); messageConverters = new HttpMessageConverter[] { new ByteArrayHttpMessageConverter(), stringHttpMessageConverter, new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter() }; }
From source file:org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.java
public AnnotationMethodHandlerAdapter() { // no restriction of HTTP methods by default super(false); // See SPR-7316 StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); this.messageConverters = new HttpMessageConverter<?>[] { new ByteArrayHttpMessageConverter(), stringHttpMessageConverter, new SourceHttpMessageConverter<Source>(), new org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter() }; }
From source file:org.springframework.web.servlet.mvc.annotation.MyAnnotationMethodHandlerAdapter.java
public MyAnnotationMethodHandlerAdapter() { // no restriction of HTTP methods by default super(false); // See SPR-7316 StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); this.messageConverters = new HttpMessageConverter[] { new ByteArrayHttpMessageConverter(), stringHttpMessageConverter, new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter() }; }