diff --git a/spring-web/src/main/java/org/springframework/http/converter/AbstractGenericHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/AbstractGenericHttpMessageConverter.java index be025f95c8..e6f31e8d6b 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/AbstractGenericHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/AbstractGenericHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.http.converter; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Type; +import java.nio.charset.Charset; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpOutputMessage; @@ -60,6 +61,17 @@ public abstract class AbstractGenericHttpMessageConverter extends AbstractHtt super(supportedMediaTypes); } + /** + * Construct an {@code AbstractGenericHttpMessageConverter} with a default charset and + * multiple supported media types. + * @param defaultCharset the default character set + * @param supportedMediaTypes the supported media types + * @since 6.2 + */ + protected AbstractGenericHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes) { + super(defaultCharset, supportedMediaTypes); + } + @Override protected boolean supports(Class clazz) {