Browse Source
Prior to this commit, it was necessary to override
the HandlerMapping definition to change properties
like useSuffixPatternMatch, useSuffixPatternMatch...
Also, one couldn't set custom pathmatcher/pathhelper
on RequestMappingHandlerMapping via XML configuration.
This commits adds a new "mvc:annotation-driven"
subelement called "mvc:path-matching" for the tag
that allows to configure such properties:
* suffix-pattern
* trailing-slash
* registered-suffixes-only
* path-matcher
* path-helper
Note: this is a new take on this issue, since
96b418cc has been reverted by e2b99c3.
Issue: SPR-10163
pull/446/merge
4 changed files with 140 additions and 5 deletions
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:mvc="http://www.springframework.org/schema/mvc" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> |
||||
|
||||
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"> |
||||
<mvc:path-matching |
||||
suffix-pattern="true" |
||||
trailing-slash="false" |
||||
registered-suffixes-only="true" |
||||
path-helper="pathHelper" |
||||
path-matcher="pathMatcher" /> |
||||
</mvc:annotation-driven> |
||||
|
||||
<bean id="pathMatcher" class="org.springframework.web.servlet.config.TestPathMatcher" /> |
||||
<bean id="pathHelper" class="org.springframework.web.servlet.config.TestPathHelper" /> |
||||
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> |
||||
<property name="mediaTypes"> |
||||
<value> |
||||
xml=application/rss+xml |
||||
</value> |
||||
</property> |
||||
</bean> |
||||
</beans> |
||||
Loading…
Reference in new issue