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