use of org.springframework.boot.web.server.MimeMappings in project connectors-workspace-one by vmware.
the class ConnectorsAutoConfiguration method webServerFactory.
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
mappings.add("hbs", "text/x-handlebars-template");
mappings.add("hal", "application/hal+json");
factory.setMimeMappings(mappings);
return factory;
}
use of org.springframework.boot.web.server.MimeMappings in project spring-boot by spring-projects.
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