ability to have multiple path patterns per mapped interceptor definition
This commit is contained in:
@@ -35,7 +35,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.core.convert.ConversionFailedException;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.style.StylerUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.support.FormattingConversionServiceFactoryBean;
|
||||
@@ -49,7 +48,6 @@ import org.springframework.validation.Validator;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor;
|
||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
import org.springframework.web.servlet.HandlerExecutionChain;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -170,6 +168,11 @@ public class MvcNamespaceTests {
|
||||
assertEquals(4, chain.getInterceptors().length);
|
||||
assertTrue(chain.getInterceptors()[3] instanceof WebRequestHandlerInterceptorAdapter);
|
||||
|
||||
request.setRequestURI("/foo/logged");
|
||||
chain = mapping.getHandler(request);
|
||||
assertEquals(4, chain.getInterceptors().length);
|
||||
assertTrue(chain.getInterceptors()[3] instanceof WebRequestHandlerInterceptorAdapter);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<mvc:annotation-driven />
|
||||
|
||||
<mvc:interceptors>
|
||||
<mvc:interceptor class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang" />
|
||||
<mvc:interceptor class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
|
||||
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang" />
|
||||
<bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
|
||||
<property name="paramName" value="style" />
|
||||
</mvc:interceptor>
|
||||
</bean>
|
||||
</mvc:interceptors>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -8,9 +8,16 @@
|
||||
<mvc:annotation-driven />
|
||||
|
||||
<mvc:interceptors>
|
||||
<mvc:interceptor class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
|
||||
<mvc:interceptor path="/**" class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
|
||||
<mvc:interceptor path="/logged/**" class="org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor" />
|
||||
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
|
||||
<mvc:interceptor>
|
||||
<mvc:path value="/**" />
|
||||
<bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
|
||||
</mvc:interceptor>
|
||||
<mvc:interceptor>
|
||||
<mvc:path value="/logged/**" />
|
||||
<mvc:path value="/foo/logged" />
|
||||
<bean class="org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor" />
|
||||
</mvc:interceptor>
|
||||
</mvc:interceptors>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<mvc:view-controller path="/bar" view-name="baz" />
|
||||
|
||||
<mvc:interceptors>
|
||||
<mvc:interceptor class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
|
||||
<mvc:interceptor class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
|
||||
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
|
||||
<bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
|
||||
</mvc:interceptors>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user