Java Code Examples for org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory#setMimeMappings()

The following examples show how to use org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory#setMimeMappings() . 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 e-commerce-microservice 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: 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 3
Source File: WebConfigurer.java    From 21-points 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 4
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 5
Source File: WebConfigurer.java    From tutorials with MIT License 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 6
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 7
Source File: WebConfigurer.java    From ehcache3-samples 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 8
Source File: WebConfigurer.java    From tutorials with MIT License 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 9
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 10
Source File: WebConfigurer.java    From tutorials with MIT License 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 11
Source File: WebConfigurer.java    From alchemy 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 12
Source File: WebConfigurer.java    From e-commerce-microservice 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 13
Source File: WebConfigurer.java    From tutorials with MIT License 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 14
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 15
Source File: WebConfigurer.java    From okta-jhipster-microservices-oauth-example 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 16
Source File: WebConfigurer.java    From okta-jhipster-microservices-oauth-example 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 17
Source File: WebConfigurer.java    From okta-jhipster-microservices-oauth-example 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 18
Source File: WebConfigurer.java    From java-microservices-examples 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 19
Source File: WebConfigurer.java    From java-microservices-examples 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 20
Source File: WebConfigurer.java    From java-microservices-examples 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);
    }
}