Add an AbstractGenericHttpMessageConverter constructor

This commit adds a new
AbstractGenericHttpMessageConverter(Charset, MediaType...)
constructor, similar to the one present in
AbstractHttpMessageConverter.

Closes gh-33563
This commit is contained in:
Sébastien Deleuze 2024-09-24 19:40:15 +02:00
parent 5f6b8d5582
commit 81a66a0334
1 changed files with 13 additions and 1 deletions

View File

@ -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<T> 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) {