org.springframework.boot.web.server.MimeMappings Java Examples

The following examples show how to use org.springframework.boot.web.server.MimeMappings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebConfigurer.java    From TeamDojo with Apache License 2.0 5 votes vote down vote up
private void setMimeMappings(WebServerFactory server) {
    if (server instanceof ConfigurableServletWebServerFactory) {
        MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
        // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
        mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
        // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
        mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
        ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
        servletWebServer.setMimeMappings(mappings);
    }
}
 
Example #2
Source File: WebConfigurer.java    From albedo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void setMimeMappings(WebServerFactory server) {
	if (server instanceof ConfigurableServletWebServerFactory) {
		MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
		// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
		mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
		// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
		mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
		ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
		servletWebServer.setMimeMappings(mappings);
	}
}
 
Example #3
Source File: ServletCustomizer.java    From openvidu with Apache License 2.0 5 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
	MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
	mappings.add("mp4", "video/mp4");
	mappings.add("webm", "video/webm");
	factory.setMimeMappings(mappings);
}
 
Example #4
Source File: WebConfigurer.java    From jhipster-registry with Apache License 2.0 5 votes vote down vote up
private void setMimeMappings(WebServerFactory server) {
    if (server instanceof ConfigurableServletWebServerFactory) {
        MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
        // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
        mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
        // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
        mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase());
        ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server;
        servletWebServer.setMimeMappings(mappings);
    }
}
 
Example #5
Source File: WebXmlSpringBoot.java    From sitemonitoring-production with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("eot", "application/vnd.ms-fontobject");
    mappings.add("otf", "font/opentype");
    mappings.add("ttf", "application/x-font-ttf");
    mappings.add("woff", "application/x-font-woff");
    mappings.add("svg", "image/svg+xml");
    mappings.add("woff2", "application/x-font-woff2");
    factory.setMimeMappings(mappings);
}
 
Example #6
Source File: WebXmlSpringBoot.java    From sitemonitoring-production with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void customize(ConfigurableServletWebServerFactory factory) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("eot", "application/vnd.ms-fontobject");
    mappings.add("otf", "font/opentype");
    mappings.add("ttf", "application/x-font-ttf");
    mappings.add("woff", "application/x-font-woff");
    mappings.add("svg", "image/svg+xml");
    mappings.add("woff2", "application/x-font-woff2");
    factory.setMimeMappings(mappings);
}
 
Example #7
Source File: WebMvcConfig.java    From apollo with Apache License 2.0 4 votes vote down vote up
@Override
public void customize(TomcatServletWebServerFactory factory) {
  MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
  mappings.add("html", "text/html;charset=utf-8");
  factory.setMimeMappings(mappings );
}