• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Jaxb2RootElementHttpMessageConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: NaverOAuth2ApiBinding

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
public NaverOAuth2ApiBinding(final String accessToken) {
	super(accessToken);
	super.setRequestFactory(ClientHttpRequestFactorySelector.bufferRequests(getRestTemplate().getRequestFactory()));

	// set interceptors
	getRestTemplate().setInterceptors(Arrays.asList(new ClientHttpRequestInterceptor[]{new AdminKeyHeaderOAuth2RequestInterceptor(accessToken)}));

	// set xml->class http message converters
	getRestTemplate().setMessageConverters(Arrays.asList(new HttpMessageConverter<?>[]{new Jaxb2RootElementHttpMessageConverter()}));

	// init api operations
	userOperation = new UserOperationImpl(getRestTemplate(), isAuthorized());
}
 
开发者ID:mornya,项目名称:spring-social-naver,代码行数:14,代码来源:NaverOAuth2ApiBinding.java


示例17: configureMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

    converters.add(new StringHttpMessageConverter());
    converters.add(new Jaxb2RootElementHttpMessageConverter());
    converters.add(new MappingJacksonHttpMessageConverter());
    converters.add(new ReportCsvMessageConverter());
}
 
开发者ID:groupon,项目名称:Novie,代码行数:9,代码来源:ContextConfig.java


示例18: getMessageConverters

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext parserContext) {
	Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
	ManagedList<? super Object> messageConverters = new ManagedList<Object>();
	if (convertersElement != null) {
		messageConverters.setSource(source);
		for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
			Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
			messageConverters.add(object);
		}
	}

	if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
		messageConverters.setSource(source);
		messageConverters.add(createConverterDefinition(ByteArrayHttpMessageConverter.class, source));

		RootBeanDefinition stringConverterDef = createConverterDefinition(StringHttpMessageConverter.class, source);
		stringConverterDef.getPropertyValues().add("writeAcceptCharset", false);
		messageConverters.add(stringConverterDef);

		messageConverters.add(createConverterDefinition(ResourceHttpMessageConverter.class, source));
		messageConverters.add(createConverterDefinition(SourceHttpMessageConverter.class, source));
		messageConverters.add(createConverterDefinition(AllEncompassingFormHttpMessageConverter.class, source));

		if (romePresent) {
			messageConverters.add(createConverterDefinition(AtomFeedHttpMessageConverter.class, source));
			messageConverters.add(createConverterDefinition(RssChannelHttpMessageConverter.class, source));
		}
		if (jaxb2Present) {
			messageConverters.add(createConverterDefinition(Jaxb2RootElementHttpMessageConverter.class, source));
		}
		if (jackson2Present) {
			messageConverters.add(createConverterDefinition(MappingJackson2HttpMessageConverter.class, source));
		}
		else if (jacksonPresent) {
			messageConverters.add(createConverterDefinition(MappingJacksonHttpMessageConverter.class, source));
		}
	}
	return messageConverters;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:40,代码来源:AnnotationDrivenBeanDefinitionParser.java


示例19: 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 (jaxb2Present) {
		this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
	}
	if (jackson2Present) {
		this.messageConverters.add(new MappingJackson2HttpMessageConverter());
	}
	else if (jacksonPresent) {
		this.messageConverters.add(new MappingJacksonHttpMessageConverter());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:RestTemplate.java


示例20: AllEncompassingFormHttpMessageConverter

import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter; //导入依赖的package包/类
public AllEncompassingFormHttpMessageConverter() {
	addPartConverter(new SourceHttpMessageConverter());
	if (jaxb2Present) {
		addPartConverter(new Jaxb2RootElementHttpMessageConverter());
	}
	if (jackson2Present) {
		addPartConverter(new MappingJackson2HttpMessageConverter());
	}
	else if (jacksonPresent) {
		addPartConverter(new MappingJacksonHttpMessageConverter());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:13,代码来源:AllEncompassingFormHttpMessageConverter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Resolution类代码示例发布时间:2022-05-21
下一篇:
Java PopupDialog类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap