Example usage for org.springframework.boot.web.server MimeMappings MimeMappings

List of usage examples for org.springframework.boot.web.server MimeMappings MimeMappings

Introduction

In this page you can find the example usage for org.springframework.boot.web.server MimeMappings MimeMappings.

Prototype

public MimeMappings() 

Source Link

Document

Create a new empty MimeMappings instance.

Usage

From source file:org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests.java

@Test
public void mimeType() throws Exception {
    FileCopyUtils.copy("test", new FileWriter(this.temporaryFolder.newFile("test.xxcss")));
    AbstractServletWebServerFactory factory = getFactory();
    factory.setDocumentRoot(this.temporaryFolder.getRoot());
    MimeMappings mimeMappings = new MimeMappings();
    mimeMappings.add("xxcss", "text/css");
    factory.setMimeMappings(mimeMappings);
    this.webServer = factory.getWebServer();
    this.webServer.start();
    ClientHttpResponse response = getClientResponse(getLocalUrl("/test.xxcss"));
    assertThat(response.getHeaders().getContentType().toString()).isEqualTo("text/css");
    response.close();//ww w  . j  av a2  s  .  c o m
}