org.springframework.http.converter.json.JsonbHttpMessageConverter Java Examples

The following examples show how to use org.springframework.http.converter.json.JsonbHttpMessageConverter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AllEncompassingFormHttpMessageConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
public AllEncompassingFormHttpMessageConverter() {
	try {
		addPartConverter(new SourceHttpMessageConverter<>());
	}
	catch (Error err) {
		// Ignore when no TransformerFactory implementation is available
	}

	if (jaxb2Present && !jackson2XmlPresent) {
		addPartConverter(new Jaxb2RootElementHttpMessageConverter());
	}

	if (jackson2Present) {
		addPartConverter(new MappingJackson2HttpMessageConverter());
	}
	else if (gsonPresent) {
		addPartConverter(new GsonHttpMessageConverter());
	}
	else if (jsonbPresent) {
		addPartConverter(new JsonbHttpMessageConverter());
	}

	if (jackson2XmlPresent) {
		addPartConverter(new MappingJackson2XmlHttpMessageConverter());
	}

	if (jackson2SmilePresent) {
		addPartConverter(new MappingJackson2SmileHttpMessageConverter());
	}
}
 
Example #2
Source File: AllEncompassingFormHttpMessageConverter.java    From java-technology-stack with MIT License 5 votes vote down vote up
public AllEncompassingFormHttpMessageConverter() {
	try {
		addPartConverter(new SourceHttpMessageConverter<>());
	}
	catch (Error err) {
		// Ignore when no TransformerFactory implementation is available
	}

	if (jaxb2Present && !jackson2XmlPresent) {
		addPartConverter(new Jaxb2RootElementHttpMessageConverter());
	}

	if (jackson2Present) {
		addPartConverter(new MappingJackson2HttpMessageConverter());
	}
	else if (gsonPresent) {
		addPartConverter(new GsonHttpMessageConverter());
	}
	else if (jsonbPresent) {
		addPartConverter(new JsonbHttpMessageConverter());
	}

	if (jackson2XmlPresent) {
		addPartConverter(new MappingJackson2XmlHttpMessageConverter());
	}

	if (jackson2SmilePresent) {
		addPartConverter(new MappingJackson2SmileHttpMessageConverter());
	}
}
 
Example #3
Source File: Spring5Application.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public HttpMessageConverters customConverters() {
    Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
    JsonbHttpMessageConverter jsonbHttpMessageConverter = new JsonbHttpMessageConverter();
    messageConverters.add(jsonbHttpMessageConverter);
    return new HttpMessageConverters(true, messageConverters);
}
 
Example #4
Source File: RestTemplate.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a new instance of the {@link RestTemplate} using default settings.
 * Default {@link HttpMessageConverter HttpMessageConverters} are initialized.
 */
public RestTemplate() {
	this.messageConverters.add(new ByteArrayHttpMessageConverter());
	this.messageConverters.add(new StringHttpMessageConverter());
	this.messageConverters.add(new ResourceHttpMessageConverter(false));
	try {
		this.messageConverters.add(new SourceHttpMessageConverter<>());
	}
	catch (Error err) {
		// Ignore when no TransformerFactory implementation is available
	}
	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());
	}
	else if (jsonbPresent) {
		this.messageConverters.add(new JsonbHttpMessageConverter());
	}

	if (jackson2SmilePresent) {
		this.messageConverters.add(new MappingJackson2SmileHttpMessageConverter());
	}
	if (jackson2CborPresent) {
		this.messageConverters.add(new MappingJackson2CborHttpMessageConverter());
	}

	this.uriTemplateHandler = initUriTemplateHandler();
}
 
Example #5
Source File: RestTemplate.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Create a new instance of the {@link RestTemplate} using default settings.
 * Default {@link HttpMessageConverter HttpMessageConverters} are initialized.
 */
public RestTemplate() {
	this.messageConverters.add(new ByteArrayHttpMessageConverter());
	this.messageConverters.add(new StringHttpMessageConverter());
	this.messageConverters.add(new ResourceHttpMessageConverter(false));
	try {
		this.messageConverters.add(new SourceHttpMessageConverter<>());
	}
	catch (Error err) {
		// Ignore when no TransformerFactory implementation is available
	}
	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());
	}
	else if (jsonbPresent) {
		this.messageConverters.add(new JsonbHttpMessageConverter());
	}

	if (jackson2SmilePresent) {
		this.messageConverters.add(new MappingJackson2SmileHttpMessageConverter());
	}
	if (jackson2CborPresent) {
		this.messageConverters.add(new MappingJackson2CborHttpMessageConverter());
	}

	this.uriTemplateHandler = initUriTemplateHandler();
}