Browse Source

Expose protected method in AbstractJackson2HttpMessageConverter

Closes gh-25509
pull/25798/head
Rossen Stoyanchev 5 years ago
parent
commit
b6ff12d2f5
  1. 10
      spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

10
spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

@ -285,7 +285,15 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener @@ -285,7 +285,15 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
}
}
private static Charset getCharset(@Nullable MediaType contentType) {
/**
* Return the charset to use for JSON input.
* <p>By default this is either the charset from the input {@code MediaType}
* or otherwise falling back on {@code UTF-8}.
* @param contentType the content type of the HTTP input message
* @return the charset to use
* @since 5.1.18
*/
protected static Charset getCharset(@Nullable MediaType contentType) {
if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset();
}

Loading…
Cancel
Save