Commit ff8fa037 by 张乐 Committed by GitHub

Merge pull request #558 from nobodyiam/fix-index-encoding

add html mime type as utf-8
parents 20b5b8e6 141edca6
package com.ctrip.framework.apollo.common.controller;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.MimeMappings;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
......@@ -11,7 +14,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import java.util.List;
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
public class WebMvcConfig extends WebMvcConfigurerAdapter implements EmbeddedServletContainerCustomizer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
......@@ -28,4 +31,10 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
configurer.ignoreAcceptHeader(true).defaultContentType(MediaType.APPLICATION_JSON);
}
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
mappings.add("html", "text/html;charset=utf-8");
container.setMimeMappings(mappings );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment