本文整理汇总了Java中org.springframework.http.converter.xml.SourceHttpMessageConverter类的典型用法代码示例。如果您正苦于以下问题:Java SourceHttpMessageConverter类的具体用法?Java SourceHttpMessageConverter怎么用?Java SourceHttpMessageConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SourceHttpMessageConverter类属于org.springframework.http.converter.xml包,在下文中一共展示了SourceHttpMessageConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDefaultHttpMessageConverters
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
/**
* Adds a set of default HttpMessageConverter instances to the given list.
* Subclasses can call this method from {@link #configureMessageConverters(List)}.
* @param messageConverters the list to add the default message converters to
*/
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
stringConverter.setWriteAcceptCharset(false);
messageConverters.add(new ByteArrayHttpMessageConverter());
messageConverters.add(stringConverter);
messageConverters.add(new ResourceHttpMessageConverter());
messageConverters.add(new SourceHttpMessageConverter<Source>());
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
if (romePresent) {
messageConverters.add(new AtomFeedHttpMessageConverter());
messageConverters.add(new RssChannelHttpMessageConverter());
}
if (jaxb2Present) {
messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
if (jackson2Present) {
messageConverters.add(new MappingJackson2HttpMessageConverter());
}
else if (jacksonPresent) {
messageConverters.add(new MappingJacksonHttpMessageConverter());
}
}
示例2: RestTemplate
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
/**
* Create a new instance of the {@link RestTemplate} using default settings.
* Default {@link HttpMessageConverter}s are initialized.
*/
@SuppressWarnings("deprecation")
public RestTemplate() {
this.messageConverters.add(new ByteArrayHttpMessageConverter());
this.messageConverters.add(new StringHttpMessageConverter());
this.messageConverters.add(new ResourceHttpMessageConverter());
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
if (romePresent) {
this.messageConverters.add(new AtomFeedHttpMessageConverter());
this.messageConverters.add(new RssChannelHttpMessageConverter());
}
if (jaxb2Present) {
this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
if (jackson2Present) {
this.messageConverters.add(new MappingJackson2HttpMessageConverter());
}
else if (jacksonPresent) {
this.messageConverters.add(new org.springframework.http.converter.json.MappingJacksonHttpMessageConverter());
}
}
示例3: MMLWebFeatureServiceRequestTemplate
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
public MMLWebFeatureServiceRequestTemplate(MMLProperties mmlProperties, ClientHttpRequestFactory clientHttpRequestFactory) {
this.mmlProperties = mmlProperties;
this.restTemplate = new RestTemplate(clientHttpRequestFactory);
final List<MediaType> xmlMediaTypes = Lists.newArrayList(
MediaType.APPLICATION_XML, MediaType.TEXT_XML,
new MediaType("application", "*+xml"),
new MediaType("application", "vnd.ogc.se_xml"));
final SourceHttpMessageConverter<Source> xmlConverter = new SourceHttpMessageConverter<>();
xmlConverter.setSupportedMediaTypes(xmlMediaTypes);
final List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
messageConverters.add(xmlConverter);
final List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
interceptors.add(new BasicAuthenticationClientInterceptor(
mmlProperties.getWfsUsername(), mmlProperties.getWfsPassword()));
this.restTemplate.setMessageConverters(messageConverters);
this.restTemplate.setInterceptors(interceptors);
}
示例4: configureMessageConverters
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
final MappingJackson2HttpMessageConverter jsonMessageConverter = jacksonMessageConverter();
final StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
stringHttpMessageConverter.setWriteAcceptCharset(false);
messageConverters.add(new CSVMessageConverter());
messageConverters.add(new ByteArrayHttpMessageConverter());
messageConverters.add(stringHttpMessageConverter);
messageConverters.add(new ResourceHttpMessageConverter());
messageConverters.add(new SourceHttpMessageConverter<>());
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
messageConverters.add(jsonMessageConverter);
messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
示例5: AllEncompassingFormHttpMessageConverter
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
public AllEncompassingFormHttpMessageConverter() {
addPartConverter(new SourceHttpMessageConverter<Source>());
if (jaxb2Present && !jackson2Present) {
addPartConverter(new Jaxb2RootElementHttpMessageConverter());
}
if (jackson2Present) {
addPartConverter(new MappingJackson2HttpMessageConverter());
}
else if (gsonPresent) {
addPartConverter(new GsonHttpMessageConverter());
}
if (jackson2XmlPresent) {
addPartConverter(new MappingJackson2XmlHttpMessageConverter());
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:AllEncompassingFormHttpMessageConverter.java
示例6: containsDefaults
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
@Test
public void containsDefaults() throws Exception {
HttpMessageConverters converters = new HttpMessageConverters();
List<Class<?>> converterClasses = new ArrayList<Class<?>>();
for (HttpMessageConverter<?> converter : converters) {
converterClasses.add(converter.getClass());
}
assertThat(converterClasses,
equalTo(Arrays.<Class<?>>asList(ByteArrayHttpMessageConverter.class,
StringHttpMessageConverter.class,
ResourceHttpMessageConverter.class,
SourceHttpMessageConverter.class,
AllEncompassingFormHttpMessageConverter.class,
MappingJackson2HttpMessageConverter.class,
MappingJackson2XmlHttpMessageConverter.class)));
}
示例7: getHttpMessageConverters
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
List<HttpMessageConverter<?>> converters = new ArrayList<>(4);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(stringHttpMessageConverter);
converters.add(new SourceHttpMessageConverter<>());
converters.add(new AllEncompassingFormHttpMessageConverter());
return converters;
}
示例8: AllEncompassingFormHttpMessageConverter
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public AllEncompassingFormHttpMessageConverter() {
addPartConverter(new SourceHttpMessageConverter<Source>());
if (jaxb2Present) {
addPartConverter(new Jaxb2RootElementHttpMessageConverter());
}
if (jackson2Present) {
addPartConverter(new MappingJackson2HttpMessageConverter());
}
else if (jacksonPresent) {
addPartConverter(new org.springframework.http.converter.json.MappingJacksonHttpMessageConverter());
}
}
示例9: AnnotationMethodHandlerAdapter
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
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() };
}
示例10: ExceptionHandlerExceptionResolver
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
public ExceptionHandlerExceptionResolver() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316
this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
this.messageConverters.add(new ByteArrayHttpMessageConverter());
this.messageConverters.add(stringHttpMessageConverter);
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
}
示例11: RequestMappingHandlerAdapter
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
public RequestMappingHandlerAdapter() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
this.messageConverters = new ArrayList<HttpMessageConverter<?>>(4);
this.messageConverters.add(new ByteArrayHttpMessageConverter());
this.messageConverters.add(stringHttpMessageConverter);
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
}
示例12: RestTemplate
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
/**
* Create a new instance of the {@link RestTemplate} using default settings.
* Default {@link HttpMessageConverter}s are initialized.
*/
public RestTemplate() {
this.messageConverters.add(new ByteArrayHttpMessageConverter());
this.messageConverters.add(new StringHttpMessageConverter());
this.messageConverters.add(new ResourceHttpMessageConverter());
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
if (romePresent) {
this.messageConverters.add(new AtomFeedHttpMessageConverter());
this.messageConverters.add(new RssChannelHttpMessageConverter());
}
if (jackson2XmlPresent) {
this.messageConverters.add(new MappingJackson2XmlHttpMessageConverter());
}
else if (jaxb2Present) {
this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
if (jackson2Present) {
this.messageConverters.add(new MappingJackson2HttpMessageConverter());
}
else if (gsonPresent) {
this.messageConverters.add(new GsonHttpMessageConverter());
}
}
示例13: getHttpMessageConverters
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
List<HttpMessageConverter<?>> converters = new ArrayList<>(4);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(stringHttpMessageConverter);
converters.add(new SourceHttpMessageConverter<>());
converters.add(new AllEncompassingFormHttpMessageConverter());
return converters;
}
示例14: containsDefaults
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
@Test
public void containsDefaults() throws Exception {
HttpMessageConverters converters = new HttpMessageConverters();
List<Class<?>> converterClasses = new ArrayList<Class<?>>();
for (HttpMessageConverter<?> converter : converters) {
converterClasses.add(converter.getClass());
}
assertThat(converterClasses).containsExactly(ByteArrayHttpMessageConverter.class,
StringHttpMessageConverter.class, ResourceHttpMessageConverter.class,
SourceHttpMessageConverter.class,
AllEncompassingFormHttpMessageConverter.class,
MappingJackson2HttpMessageConverter.class,
MappingJackson2XmlHttpMessageConverter.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:HttpMessageConvertersTests.java
示例15: configureMessageConverters
import org.springframework.http.converter.xml.SourceHttpMessageConverter; //导入依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
stringConverter.setWriteAcceptCharset(false);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(stringConverter);
converters.add(new ResourceHttpMessageConverter());
converters.add(new SourceHttpMessageConverter<Source>());
converters.add(new AllEncompassingFormHttpMessageConverter());
}