Merge branch '2.5.x' into 2.6.x

Closes gh-30738
pull/30839/head
Stephane Nicoll 3 years ago
commit 91625207b2

@ -27,6 +27,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
@ -80,6 +81,8 @@ import org.springframework.boot.web.server.WebServerException;
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@ -405,13 +408,15 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
}
@Test
void defaultLocaleCharsetMappingsAreOverridden() {
void defaultLocaleCharsetMappingsAreOverridden() throws IOException {
TomcatServletWebServerFactory factory = getFactory();
this.webServer = factory.getWebServer();
// override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties
assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8);
assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8);
assertThat(getCharset(Locale.JAPANESE)).isEqualTo(StandardCharsets.UTF_8);
Properties charsetMapperDefault = PropertiesLoaderUtils
.loadProperties(new ClassPathResource("CharsetMapperDefault.properties", CharsetMapper.class));
for (String language : charsetMapperDefault.stringPropertyNames()) {
assertThat(getCharset(new Locale(language))).isEqualTo(StandardCharsets.UTF_8);
}
}
@Test

Loading…
Cancel
Save