当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurableEmbeddedServletContainer.setMimeMappings方法代码示例

本文整理汇总了Java中org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer.setMimeMappings方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableEmbeddedServletContainer.setMimeMappings方法的具体用法?Java ConfigurableEmbeddedServletContainer.setMimeMappings怎么用?Java ConfigurableEmbeddedServletContainer.setMimeMappings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer的用法示例。


在下文中一共展示了ConfigurableEmbeddedServletContainer.setMimeMappings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:27,代码来源:WebConfigurer.java

示例2: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    File root;
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) {
        root = new File("build/www/");
    } else {
        root = new File("src/main/webapp/");
    }
    if (root.exists() && root.isDirectory()) {
        container.setDocumentRoot(root);
    }
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:24,代码来源:WebConfigurer.java

示例3: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
	MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
	// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
	mappings.add("html", "text/html;charset=utf-8");
	// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
	mappings.add("json", "text/html;charset=utf-8");
	container.setMimeMappings(mappings);
	// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
	setLocationForStaticAssets(container);

       /*
        * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
        * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
        * See the JHipsterProperties class and your application-*.yml configuration files
        * for more information.
        */
	if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
		container instanceof UndertowEmbeddedServletContainerFactory) {

		((UndertowEmbeddedServletContainerFactory) container)
			.addBuilderCustomizers(builder ->
				builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
	}
}
 
开发者ID:alikemalocalan,项目名称:MicroBlog,代码行数:29,代码来源:WebConfigurer.java

示例4: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
  // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
  mappings.add("html", "text/html;charset=utf-8");
  // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
  mappings.add("json", "text/html;charset=utf-8");

  mappings.add("svg", "image/svg+xml");
  mappings.add("ttf", "application/x-font-ttf");
  mappings.add("otf", "application/x-font-opentype");
  mappings.add("woff", "application/font-woff");
  mappings.add("woff2", "application/font-woff2");
  mappings.add("eot", "application/vnd.ms-fontobject");
  mappings.add("sfnt", "application/font-sfnt");
  mappings.add("odt", "application/vnd.oasis.opendocument.text");
  mappings.add("pdf", "application/pdf");
  mappings.add("jpg", "image/jpeg");
  mappings.add("jpeg", "image/jpeg");
  mappings.add("png", "image/png");
  mappings.add("gif", "image/gif");

  container.setMimeMappings(mappings);
}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:28,代码来源:WebConfigurer.java

示例5: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
   
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:14,代码来源:WebConfigurer.java

示例6: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
}
 
开发者ID:Cinderpup,项目名称:RoboInsta,代码行数:13,代码来源:WebConfigurer.java

示例7: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("html", "text/html;charset=utf-8");
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);
}
 
开发者ID:megadotnet,项目名称:SpringBootDemoApp,代码行数:13,代码来源:WebConfigurer.java

示例8: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
}
 
开发者ID:ugouku,项目名称:shoucang,代码行数:13,代码来源:WebConfigurer.java

示例9: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);
}
 
开发者ID:klask-io,项目名称:klask-io,代码行数:16,代码来源:WebConfigurer.java

示例10: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);

    // Make sure fonts are served with the correct mime-type (IE!)
    mappings.add("woff", "application/font-woff");
    mappings.add("woff2","application/font-woff2");
    mappings.add("ttf","application/x-font-truetype");
    mappings.add("eot","application/vnd.ms-fontobject");
    mappings.add("otf","application/vnd.ms-opentype");

    container.setMimeMappings(mappings);
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:14,代码来源:StaticWebResourceConfiguration.java

示例11: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:13,代码来源:WebConfigurer.java

示例12: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    setLocationForStaticAssets(container);
}
 
开发者ID:k8s-for-greeks,项目名称:gpmr,代码行数:16,代码来源:WebConfigurer.java

示例13: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * The method customize customizes the mime mapping and add it to the provided container
 * @param container The configurable embedded servlet container
 */
@Override
public void customize(final ConfigurableEmbeddedServletContainer container) {
    final MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("xsd", "text/xml; charset=utf-8");
    mappings.add("ico", "image/x-icon");
    container.setMimeMappings(mappings);
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:12,代码来源:MimeConfig.java

示例14: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
	MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
	mappings.add("woff", "application/font-woff");
	mappings.add("woff2", "application/font-woff2");
	mappings.add("ttf", "application/x-font-truetype");
	mappings.add("eot", "application/vnd.ms-fontobject");
	mappings.add("svg", "image/svg+xml");
	mappings.add("otf", "application/x-font-opentype");
	container.setMimeMappings(mappings);
}
 
开发者ID:abixen,项目名称:abixen-platform,代码行数:12,代码来源:PlatformWebFontMimeMapper.java

示例15: customize

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
  mappings.add("html", "text/html;charset=utf-8");
  mappings.add("json", "text/html;charset=utf-8");
  container.setMimeMappings(mappings);
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:11,代码来源:WebConfigurer.java


注:本文中的org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer.setMimeMappings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。