|
24 | 24 | import java.util.Map;
|
25 | 25 |
|
26 | 26 | import io.undertow.UndertowOptions;
|
| 27 | +import jakarta.servlet.http.HttpServlet; |
| 28 | +import jakarta.servlet.http.HttpServletRequest; |
| 29 | +import jakarta.servlet.http.HttpServletResponse; |
27 | 30 | import org.apache.catalina.connector.Connector;
|
28 | 31 | import org.apache.catalina.core.StandardContext;
|
29 | 32 | import org.apache.catalina.core.StandardEngine;
|
30 | 33 | import org.apache.catalina.valves.AccessLogValve;
|
31 | 34 | import org.apache.catalina.valves.RemoteIpValve;
|
32 | 35 | import org.apache.coyote.AbstractProtocol;
|
33 | 36 | import org.apache.tomcat.util.net.AbstractEndpoint;
|
34 |
| -import org.eclipse.jetty.ee10.servlet.ServletContextHandler; |
35 | 37 | import org.eclipse.jetty.server.Server;
|
| 38 | +import org.eclipse.jetty.servlet.ServletContextHandler; |
36 | 39 | import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
37 | 40 | import org.junit.jupiter.api.Test;
|
38 | 41 | import reactor.netty.http.HttpDecoderSpec;
|
|
46 | 49 | import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
|
47 | 50 | import org.springframework.boot.web.embedded.jetty.JettyWebServer;
|
48 | 51 | import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
| 52 | +import org.springframework.boot.web.server.MimeMappings; |
| 53 | +import org.springframework.boot.web.server.MimeMappings.Mapping; |
| 54 | +import org.springframework.http.HttpEntity; |
| 55 | +import org.springframework.http.HttpHeaders; |
| 56 | +import org.springframework.http.MediaType; |
| 57 | +import org.springframework.http.client.ClientHttpResponse; |
49 | 58 | import org.springframework.test.util.ReflectionTestUtils;
|
50 | 59 | import org.springframework.util.unit.DataSize;
|
51 | 60 |
|
|
66 | 75 | * @author Rafiullah Hamedy
|
67 | 76 | * @author Chris Bono
|
68 | 77 | * @author Parviz Rozikov
|
| 78 | + * @author Lasse Wulff |
69 | 79 | */
|
70 | 80 | @DirtiesUrlFactories
|
71 | 81 | class ServerPropertiesTests {
|
@@ -182,6 +192,21 @@ void testContextPathWithLeadingAndTrailingWhitespaceAndContextWithSpace() {
|
182 | 192 | assertThat(this.properties.getServlet().getContextPath()).isEqualTo("/assets /copy");
|
183 | 193 | }
|
184 | 194 |
|
| 195 | + @Test |
| 196 | + void testDefaultMimeMapping() { |
| 197 | + assertThat(this.properties.getMimeMappings()) |
| 198 | + .containsExactly(MimeMappings.DEFAULT.getAll().toArray(new Mapping[0])); |
| 199 | + } |
| 200 | + |
| 201 | + @Test |
| 202 | + void testCustomizedMimeMapping() { |
| 203 | + MimeMappings expectedMappings = MimeMappings.lazyCopy(MimeMappings.DEFAULT); |
| 204 | + expectedMappings.add("mjs", "text/javascript"); |
| 205 | + bind("server.mime-mappings.mjs", "text/javascript"); |
| 206 | + assertThat(this.properties.getMimeMappings()) |
| 207 | + .containsExactly(expectedMappings.getAll().toArray(new Mapping[0])); |
| 208 | + } |
| 209 | + |
185 | 210 | @Test
|
186 | 211 | void testCustomizeUriEncoding() {
|
187 | 212 | bind("server.tomcat.uri-encoding", "US-ASCII");
|
|
0 commit comments