use of cn.taketoday.framework.web.server.MimeMappings in project today-framework by TAKETODAY.
the class AbstractServletWebServerFactoryTests method mimeType.
@Test
void mimeType() throws Exception {
FileCopyUtils.copy("test", new FileWriter(new File(this.tempDir, "test.xxcss")));
AbstractServletWebServerFactory factory = getFactory();
factory.setRegisterDefaultServlet(true);
factory.setDocumentRoot(this.tempDir);
MimeMappings mimeMappings = new MimeMappings();
mimeMappings.add("xxcss", "text/css");
factory.setMimeMappings(mimeMappings);
this.webServer = factory.getWebServer();
this.webServer.start();
ClientHttpResponse response = getClientResponse(getLocalUrl("/test.xxcss"));
assertThat(response.getHeaders().getContentType().toString()).isEqualTo("text/css");
response.close();
}
use of cn.taketoday.framework.web.server.MimeMappings in project today-infrastructure by TAKETODAY.
the class AbstractServletWebServerFactoryTests method mimeType.
@Test
void mimeType() throws Exception {
FileCopyUtils.copy("test", new FileWriter(new File(this.tempDir, "test.xxcss")));
AbstractServletWebServerFactory factory = getFactory();
factory.setRegisterDefaultServlet(true);
factory.setDocumentRoot(this.tempDir);
MimeMappings mimeMappings = new MimeMappings();
mimeMappings.add("xxcss", "text/css");
factory.setMimeMappings(mimeMappings);
this.webServer = factory.getWebServer();
this.webServer.start();
ClientHttpResponse response = getClientResponse(getLocalUrl("/test.xxcss"));
assertThat(response.getHeaders().getContentType().toString()).isEqualTo("text/css");
response.close();
}
Aggregations