Java Code Examples for org.springframework.boot.context.embedded.MimeMappings

The following are top voted examples for showing how to use org.springframework.boot.context.embedded.MimeMappings. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: xm-gate   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example 2
Project: xm-ms-entity   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example 3
Project: xm-ms-config   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example 4
Project: jhipster-ribbon-hystrix   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 5
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: TomcatEmbeddedServletContainerFactory.java   View source code 6 votes vote down vote up
/**
 * Configure the Tomcat {@link Context}.
 * @param context the Tomcat context
 * @param initializers initializers to apply
 */
protected void configureContext(Context context,
		ServletContextInitializer[] initializers) {
	TomcatStarter starter = new TomcatStarter(initializers);
	if (context instanceof TomcatEmbeddedContext) {
		// Should be true
		((TomcatEmbeddedContext) context).setStarter(starter);
	}
	context.addServletContainerInitializer(starter, NO_CLASSES);
	for (LifecycleListener lifecycleListener : this.contextLifecycleListeners) {
		context.addLifecycleListener(lifecycleListener);
	}
	for (Valve valve : this.contextValves) {
		context.getPipeline().addValve(valve);
	}
	for (ErrorPage errorPage : getErrorPages()) {
		new TomcatErrorPage(errorPage).addToContext(context);
	}
	for (MimeMappings.Mapping mapping : getMimeMappings()) {
		context.addMimeMapping(mapping.getExtension(), mapping.getMimeType());
	}
	configureSession(context);
	for (TomcatContextCustomizer customizer : this.tomcatContextCustomizers) {
		customizer.customize(context);
	}
}
 
Example 6
Project: MicroBlog   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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));
	}
}
 
Example 7
Project: spring-boot-concourse   File: TomcatEmbeddedServletContainerFactory.java   View source code 6 votes vote down vote up
/**
 * Configure the Tomcat {@link Context}.
 * @param context the Tomcat context
 * @param initializers initializers to apply
 */
protected void configureContext(Context context,
		ServletContextInitializer[] initializers) {
	TomcatStarter starter = new TomcatStarter(initializers);
	if (context instanceof TomcatEmbeddedContext) {
		// Should be true
		((TomcatEmbeddedContext) context).setStarter(starter);
	}
	context.addServletContainerInitializer(starter, NO_CLASSES);
	for (LifecycleListener lifecycleListener : this.contextLifecycleListeners) {
		context.addLifecycleListener(lifecycleListener);
	}
	for (Valve valve : this.contextValves) {
		context.getPipeline().addValve(valve);
	}
	for (ErrorPage errorPage : getErrorPages()) {
		new TomcatErrorPage(errorPage).addToContext(context);
	}
	for (MimeMappings.Mapping mapping : getMimeMappings()) {
		context.addMimeMapping(mapping.getExtension(), mapping.getMimeType());
	}
	configureSession(context);
	for (TomcatContextCustomizer customizer : this.tomcatContextCustomizers) {
		customizer.customize(context);
	}
}
 
Example 8
Project: contestparser   File: TomcatEmbeddedServletContainerFactory.java   View source code 6 votes vote down vote up
/**
 * Configure the Tomcat {@link Context}.
 * @param context the Tomcat context
 * @param initializers initializers to apply
 */
protected void configureContext(Context context,
		ServletContextInitializer[] initializers) {
	TomcatStarter starter = new TomcatStarter(initializers);
	if (context instanceof TomcatEmbeddedContext) {
		// Should be true
		((TomcatEmbeddedContext) context).setStarter(starter);
	}
	context.addServletContainerInitializer(starter, NO_CLASSES);
	for (LifecycleListener lifecycleListener : this.contextLifecycleListeners) {
		context.addLifecycleListener(lifecycleListener);
	}
	for (Valve valve : this.contextValves) {
		context.getPipeline().addValve(valve);
	}
	for (ErrorPage errorPage : getErrorPages()) {
		new TomcatErrorPage(errorPage).addToContext(context);
	}
	for (MimeMappings.Mapping mapping : getMimeMappings()) {
		context.addMimeMapping(mapping.getExtension(), mapping.getMimeType());
	}
	configureSession(context);
	for (TomcatContextCustomizer customizer : this.tomcatContextCustomizers) {
		customizer.customize(context);
	}
}
 
Example 9
Project: metadatamanagement   File: WebConfigurer.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: buenojo   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
   
}
 
Example 11
Project: RoboInsta   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 12
Project: SpringBootDemoApp   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 13
Project: shoucang   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 14
Project: klask-io   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 15
Project: smarti   File: StaticWebResourceConfiguration.java   View source code 5 votes vote down vote up
@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);
}
 
Example 16
Project: blogAggr   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 17
Project: transandalus-backend   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 18
Project: jhipster-ribbon-hystrix   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 19
Project: jhipster-ribbon-hystrix   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 20
Project: gpmr   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 21
Project: gameofcode   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 22
Project: https-github.com-g0t4-jenkins2-course-spring-boot   File: JettyEmbeddedServletContainerFactory.java   View source code 5 votes vote down vote up
/**
 * Create a configuration object that adds mime type mappings.
 * @return a configuration object for adding mime type mappings
 */
private Configuration getMimeTypeConfiguration() {
	return new AbstractConfiguration() {

		@Override
		public void configure(WebAppContext context) throws Exception {
			MimeTypes mimeTypes = context.getMimeTypes();
			for (MimeMappings.Mapping mapping : getMimeMappings()) {
				mimeTypes.addMimeMapping(mapping.getExtension(),
						mapping.getMimeType());
			}
		}

	};
}
 
Example 23
Project: castlemock   File: MimeConfig.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 24
Project: shoucang   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 25
Project: blackhole   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 26
Project: oyd-pia   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 27
Project: readthisstuff.com   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 28
Project: abixen-platform   File: PlatformWebFontMimeMapper.java   View source code 5 votes vote down vote up
@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);
}
 
Example 29
Project: spring-boot-concourse   File: JettyEmbeddedServletContainerFactory.java   View source code 5 votes vote down vote up
/**
 * Create a configuration object that adds mime type mappings.
 * @return a configuration object for adding mime type mappings
 */
private Configuration getMimeTypeConfiguration() {
	return new AbstractConfiguration() {

		@Override
		public void configure(WebAppContext context) throws Exception {
			MimeTypes mimeTypes = context.getMimeTypes();
			for (MimeMappings.Mapping mapping : getMimeMappings()) {
				mimeTypes.addMimeMapping(mapping.getExtension(),
						mapping.getMimeType());
			}
		}

	};
}
 
Example 30
Project: jhipster-ionic   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 31
Project: portal-de-servicos   File: ServletContainerConfig.java   View source code 5 votes vote down vote up
private void addMimeMappingsForFonts(ConfigurableEmbeddedServletContainer servletContainer) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("eot", "application/vnd.ms-fontobject");
    mappings.add("ttf", "application/font-sfnt");
    mappings.add("otf", "application/font-sfnt");
    mappings.add("woff", "application/font-woff");
    mappings.add("woff2", "application/font-woff");
    servletContainer.setMimeMappings(mappings);
}
 
Example 32
Project: angularjs-springboot-bookstore   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 33
Project: lobbycal   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 34
Project: contestparser   File: JettyEmbeddedServletContainerFactory.java   View source code 5 votes vote down vote up
/**
 * Create a configuration object that adds mime type mappings.
 * @return a configuration object for adding mime type mappings
 */
private Configuration getMimeTypeConfiguration() {
	return new AbstractConfiguration() {
		@Override
		public void configure(WebAppContext context) throws Exception {
			MimeTypes mimeTypes = context.getMimeTypes();
			for (MimeMappings.Mapping mapping : getMimeMappings()) {
				mimeTypes.addMimeMapping(mapping.getExtension(),
						mapping.getMimeType());
			}
		}
	};
}
 
Example 35
Project: nosql-java   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 36
Project: nosql-java   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 37
Project: nosql-java   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 38
Project: nosql-java   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 39
Project: ServiceCutter   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 40
Project: spring-boot-angularjs-examples   File: WebConfigurer.java   View source code 5 votes vote down vote up
/**
 * 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);
}