当前位置: 首页>>代码示例>>Java>>正文


Java Jaxb2RootElementHttpMessageConverter类代码示例

本文整理汇总了Java中org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter的典型用法代码示例。如果您正苦于以下问题:Java Jaxb2RootElementHttpMessageConverter类的具体用法?Java Jaxb2RootElementHttpMessageConverter怎么用?Java Jaxb2RootElementHttpMessageConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Jaxb2RootElementHttpMessageConverter类属于org.springframework.http.converter.xml包,在下文中一共展示了Jaxb2RootElementHttpMessageConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDefaultHttpMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:30,代码来源:WebMvcConfigurationSupport.java

示例2: RestTemplate

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:RestTemplate.java

示例3: configureMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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());
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:17,代码来源:WebMVCConfig.java

示例4: AllEncompassingFormHttpMessageConverter

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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

示例5: setup

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Before
public void setup() {

	List<Person> composers = Arrays.asList(
			new Person("Johann Sebastian Bach").setSomeDouble(21),
			new Person("Johannes Brahms").setSomeDouble(.0025),
			new Person("Edvard Grieg").setSomeDouble(1.6035),
			new Person("Robert Schumann").setSomeDouble(Double.NaN));

	List<Person> performers = Arrays.asList(
			new Person("Vladimir Ashkenazy").setSomeBoolean(false),
			new Person("Yehudi Menuhin").setSomeBoolean(true));

	this.people = new PeopleWrapper(composers, performers);

	List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
	converters.add(new Jaxb2RootElementHttpMessageConverter());

	this.restTemplate = new RestTemplate();
	this.restTemplate.setMessageConverters(converters);

	this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:XpathRequestMatchersIntegrationTests.java

示例6: setup

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Before
public void setup() {

	List<Person> composers = Arrays.asList(
			new Person("Johann Sebastian Bach").setSomeDouble(21),
			new Person("Johannes Brahms").setSomeDouble(.0025),
			new Person("Edvard Grieg").setSomeDouble(1.6035),
			new Person("Robert Schumann").setSomeDouble(Double.NaN));

	this.people = new PeopleWrapper(composers);

	List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
	converters.add(new Jaxb2RootElementHttpMessageConverter());

	this.restTemplate = new RestTemplate();
	this.restTemplate.setMessageConverters(converters);

	this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:XmlContentRequestMatchersIntegrationTests.java

示例7: shouldFailIfNoConverterFoundForBodyOfUnknownContentType

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Test
public void shouldFailIfNoConverterFoundForBodyOfUnknownContentType() {
    final MockSetup setup = new MockSetup("https://api.example.com", Collections.emptyList());
    final MockRestServiceServer server = setup.getServer();
    final Http unit = setup.getHttpBuilder()
            .converter(new Jaxb2RootElementHttpMessageConverter()).build();

    // we never actually make the request, but the mock server is doing some magic pre-actively
    server.expect(requestTo(url))
            .andRespond(withSuccess());

    exception.expect(RestClientException.class);
    exception.expectMessage("no suitable HttpMessageConverter found ");
    exception.expectMessage("org.zalando.riptide.model.Success");

    unit.delete(url)
            .body(new Success(true))
            .dispatch(contentType());

    server.verify();
}
 
开发者ID:zalando,项目名称:riptide,代码行数:22,代码来源:ExecuteTest.java

示例8: setup

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Before
public void setup()
{
    MockitoAnnotations.initMocks(this);

    /*
     * mockMvc object is being set up to support both XML and JSON
     * 
     * runtime 'com.fasterxml.jackson.core:jackson-core:2.2.2'
     * 
     * runtime 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
     * 
     * runtime 'javax.xml.bind:jaxb-api:2.2.9'
     */
    this.mockMvc = standaloneSetup(controller)
            .setMessageConverters(new MappingJackson2HttpMessageConverter(),
                    new Jaxb2RootElementHttpMessageConverter()).build();
}
 
开发者ID:huangye177,项目名称:spring4probe,代码行数:19,代码来源:ViewOrderXmlIntegrationTest.java

示例9: AllEncompassingFormHttpMessageConverter

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AllEncompassingFormHttpMessageConverter.java

示例10: getDefaultWxMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
/**
 * 只考虑微信的消息转换,后期可以优化
 * 其实这里完全可以使用系统的Bean,但是这里我想特殊处理,只对微信消息做转换,所以定制化了几个converter
 *
 * @return dummy
 */
private HttpMessageConverters getDefaultWxMessageConverters() {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
    stringConverter.setWriteAcceptCharset(false);
    MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
    Jaxb2RootElementHttpMessageConverter xmlConverter = new Jaxb2RootElementHttpMessageConverter();
    AllEncompassingFormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter();
    ResourceHttpMessageConverter resourceConverter = new ResourceHttpMessageConverter();
    HttpMessageConverters wxMessageConverters = new HttpMessageConverters(stringConverter, jsonConverter, xmlConverter, formConverter, resourceConverter);
    return wxMessageConverters;
}
 
开发者ID:FastBootWeixin,项目名称:FastBootWeixin,代码行数:17,代码来源:WxInvokerConfiguration.java

示例11: RestTemplate

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的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());
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:31,代码来源:RestTemplate.java

示例12: initRestTemplate

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Override
protected void initRestTemplate(RestTemplate restTemplate) {
    super.initRestTemplate(restTemplate);
    restTemplate.setErrorHandler(new DCTMJaxbErrorHandler(restTemplate.getMessageConverters()));
    for(HttpMessageConverter<?> c : restTemplate.getMessageConverters()) {
        if(c instanceof FormHttpMessageConverter) {
            ((FormHttpMessageConverter)c).addPartConverter(new Jaxb2RootElementHttpMessageConverter());
            break;
        }
    }
}
 
开发者ID:Enterprise-Content-Management,项目名称:documentum-rest-client-java,代码行数:12,代码来源:DCTMJaxbClient.java

示例13: configureMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
    converter.setObjectMapper(objectMapperBuilder().build());
    
    converters.add(new Jaxb2RootElementHttpMessageConverter());
    converters.add(new Jaxb2CollectionHttpMessageConverter<>());
    converters.add(converter);
    super.configureMessageConverters(converters);
}
 
开发者ID:gjong,项目名称:web-harvester,代码行数:11,代码来源:ApiConfiguration.java

示例14: configureMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    converters.add(new MappingJackson2HttpMessageConverter());
    converters.add(new Jaxb2RootElementHttpMessageConverter());
    converters.add(new Jaxb2CollectionHttpMessageConverter<>());
    converters.add(new HtmlMessageConverter());
}
 
开发者ID:adobe-research,项目名称:cross-preferences,代码行数:8,代码来源:Config.java

示例15: createRestTemplate

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
private static RestTemplate createRestTemplate() {
	List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
	messageConverters.add(new ByteArrayHttpMessageConverter());
	messageConverters.add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
	messageConverters.add(new ResourceHttpMessageConverter());
	messageConverters.add(new SourceHttpMessageConverter<Source>());
	messageConverters.add(new AllEncompassingFormHttpMessageConverter());
	messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
	messageConverters.add(new MappingJackson2HttpMessageConverter());

	return new RestTemplate(messageConverters);
}
 
开发者ID:bullhorn,项目名称:sdk-rest,代码行数:13,代码来源:RestTemplateFactory.java


注:本文中的org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。