Java Code Examples for com.fasterxml.jackson.core.JsonEncoding#values()

The following examples show how to use com.fasterxml.jackson.core.JsonEncoding#values() . 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: MappingJackson2MessageConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the MIME type from the MessageHeaders, if any
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(@Nullable MimeType contentType) {
	if (contentType != null && (contentType.getCharset() != null)) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 2
Source File: AbstractJackson2HttpMessageConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the media type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(@Nullable MediaType contentType) {
	if (contentType != null && contentType.getCharset() != null) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 3
Source File: AbstractJackson2Encoder.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given mime type.
 * @param mimeType the mime type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 * @since 5.0.5
 */
protected JsonEncoding getJsonEncoding(@Nullable MimeType mimeType) {
	if (mimeType != null && mimeType.getCharset() != null) {
		Charset charset = mimeType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 4
Source File: MappingJackson2MessageConverter.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the MIME type from the MessageHeaders, if any
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(@Nullable MimeType contentType) {
	if (contentType != null && (contentType.getCharset() != null)) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 5
Source File: AbstractJackson2HttpMessageConverter.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the media type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(@Nullable MediaType contentType) {
	if (contentType != null && contentType.getCharset() != null) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 6
Source File: AbstractJackson2Encoder.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given mime type.
 * @param mimeType the mime type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 * @since 5.0.5
 */
protected JsonEncoding getJsonEncoding(@Nullable MimeType mimeType) {
	if (mimeType != null && mimeType.getCharset() != null) {
		Charset charset = mimeType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 7
Source File: AbstractJackson2HttpMessageConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the media type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(MediaType contentType) {
	if (contentType != null && contentType.getCharset() != null) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 8
Source File: MappingJackson2MessageConverter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the MIME type from the MessageHeaders, if any
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(MimeType contentType) {
	if ((contentType != null) && (contentType.getCharSet() != null)) {
		Charset charset = contentType.getCharSet();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 9
Source File: AbstractJackson2HttpMessageConverter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 * @param contentType the media type as requested by the caller
 * @return the JSON encoding to use (never {@code null})
 */
protected JsonEncoding getJsonEncoding(MediaType contentType) {
	if (contentType != null && contentType.getCharSet() != null) {
		Charset charset = contentType.getCharSet();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 10
Source File: MappingJacksonRPC2HttpMessageConverter.java    From jsonrpc4j with MIT License 5 votes vote down vote up
/**
 * Determine the JSON encoding to use for the given content type.
 *
 * @param contentType the media type as requested by the caller
 * @return the JSON encoding to use (never <code>null</code>)
 */
private JsonEncoding getJsonEncoding(MediaType contentType) {
	if (contentType != null && contentType.getCharset() != null) {
		Charset charset = contentType.getCharset();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}
 
Example 11
Source File: MappingJacksonHttpMessageConverter.java    From android-viewer-for-khan-academy with GNU General Public License v3.0 5 votes vote down vote up
private JsonEncoding getEncoding(MediaType contentType) {
	if (contentType != null && contentType.getCharSet() != null) {
		Charset charset = contentType.getCharSet();
		for (JsonEncoding encoding : JsonEncoding.values()) {
			if (charset.name().equals(encoding.getJavaName())) {
				return encoding;
			}
		}
	}
	return JsonEncoding.UTF8;
}