You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.4 KiB
36 lines
1.4 KiB
package org.pqh.config;
|
|
|
|
import org.pqh.core.util.LogManger;
|
|
import org.springframework.web.WebApplicationInitializer;
|
|
|
|
import javax.servlet.ServletContext;
|
|
import javax.servlet.ServletException;
|
|
|
|
/**
|
|
* Created by reborn on 2017/9/18.
|
|
*/
|
|
public class WebConfigImpl implements WebApplicationInitializer,LogManger{
|
|
private String encoding ="UTF-8";
|
|
|
|
@Override
|
|
public void onStartup(ServletContext servletContext) throws ServletException {
|
|
log.info("onStartup");
|
|
// //基于注解配置的上下文
|
|
// AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
|
|
// //注册Spring容器配置类
|
|
// context.register(SpringConfig.class);
|
|
// ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(context));
|
|
// //配置映射路径
|
|
// servlet.addMapping("/");
|
|
// //启动顺序
|
|
// servlet.setLoadOnStartup(1);
|
|
//
|
|
//
|
|
// servletContext.addListener(new ContextLoaderListener(context));
|
|
//
|
|
// FilterRegistration.Dynamic characterEncodingFilter=servletContext.addFilter("CharacterEncodingFilter", CharacterEncodingFilter.class);
|
|
// servletContext.log("CharacterEncodingFilter设置编码:"+encoding);
|
|
// characterEncodingFilter.setInitParameter("encoding",encoding);
|
|
// characterEncodingFilter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST),true,"/*");
|
|
}
|
|
}
|
|
|