Permalink
Browse files

Customized RequestMappingHandlerMapping and set defaultHtmlEscape to

true
  • Loading branch information...
1 parent eb34c50 commit b96091b844d62d1d96e0c897527fe5e2530a7847 @kolorobot committed Mar 30, 2012
@@ -18,7 +18,8 @@ public void onStartup(ServletContext servletContext) throws ServletException {
rootContext.register(RootConfig.class);
servletContext.addListener(new ContextLoaderListener(rootContext));
-
+ servletContext.setInitParameter("defaultHtmlEscape", "true");
+
AnnotationConfigWebApplicationContext mvcContext = new AnnotationConfigWebApplicationContext();
mvcContext.register(WebMvcConfig.class);
@@ -8,12 +8,12 @@
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.view.tiles2.TilesConfigurer;
import org.springframework.web.servlet.view.tiles2.TilesViewResolver;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@Configuration
-@EnableWebMvc
@ComponentScan(basePackages = { "${package}" })
@Import(PersistenceConfig.class)
-public class WebMvcConfig extends WebMvcConfigurerAdapter {
+public class WebMvcConfig extends WebMvcConfigurationSupport {
private static final String MESSAGE_SOURCE = "/WEB-INF/classes/messages";
private static final String TILES = "/WEB-INF/tiles/tiles.xml";
@@ -22,6 +22,14 @@
private static final String RESOURCES_HANDLER = "/resources/";
private static final String RESOURCES_LOCATION = RESOURCES_HANDLER + "**";
+ @Override
+ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
+ RequestMappingHandlerMapping requestMappingHandlerMapping = super.requestMappingHandlerMapping();
+ requestMappingHandlerMapping.setUseSuffixPatternMatch(false);
+ requestMappingHandlerMapping.setUseTrailingSlashMatch(false);
+ return requestMappingHandlerMapping;
+ }
+
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();

0 comments on commit b96091b

Please sign in to comment.