Last active
October 10, 2016 16:57
-
-
Save bava/8628946 to your computer and use it in GitHub Desktop.
Spring MVC Application Initializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.inflinx.springmvc.config; | |
import javax.servlet.Filter; | |
import org.sitemesh.config.ConfigurableSiteMeshFilter; | |
import org.springframework.web.filter.CharacterEncodingFilter; | |
import org.springframework.web.filter.HiddenHttpMethodFilter; | |
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; | |
public class SpringMvcApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { | |
@Override | |
protected Class<?>[] getRootConfigClasses() { | |
return null; | |
} | |
@Override | |
protected Class<?>[] getServletConfigClasses() { | |
return new Class[] {WebConfig.class}; | |
} | |
@Override | |
protected String[] getServletMappings() { | |
return new String[] { "/" }; | |
} | |
protected Filter[] getServletFilters() { | |
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); | |
characterEncodingFilter.setEncoding("UTF-8"); | |
return new Filter[] { new HiddenHttpMethodFilter(), characterEncodingFilter, new ConfigurableSiteMeshFilter() }; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment