类org.springframework.boot.web.server.MimeMappings源码实例Demo

下面列出了怎么用org.springframework.boot.web.server.MimeMappings的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TeamDojo   文件: WebConfigurer.java
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);
    }
}
 
源代码2 项目: albedo   文件: WebConfigurer.java
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);
	}
}
 
源代码3 项目: openvidu   文件: ServletCustomizer.java
@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);
}
 
源代码4 项目: jhipster-registry   文件: WebConfigurer.java
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);
    }
}
 
@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);
}
 
@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);
}
 
源代码7 项目: apollo   文件: WebMvcConfig.java
@Override
public void customize(TomcatServletWebServerFactory factory) {
  MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
  mappings.add("html", "text/html;charset=utf-8");
  factory.setMimeMappings(mappings );
}
 
 类所在包
 类方法
 同包方法