Java Code Examples for org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#getHandler()

The following examples show how to use org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#getHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 2
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 3
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 4
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 5
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml", 6);

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 6
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml", 6);

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 7
Source File: WebMvcConfigurationSupportExtensionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void contentNegotiation() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo.json");
	NativeWebRequest webRequest = new ServletWebRequest(request);

	RequestMappingHandlerMapping mapping = this.config.requestMappingHandlerMapping(
			this.config.mvcContentNegotiationManager(), this.config.mvcConversionService(),
			this.config.mvcResourceUrlProvider());
	ContentNegotiationManager manager = mapping.getContentNegotiationManager();
	assertEquals(Collections.singletonList(APPLICATION_JSON), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.xml");
	assertEquals(Collections.singletonList(APPLICATION_XML), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.rss");
	assertEquals(Collections.singletonList(MediaType.valueOf("application/rss+xml")),
			manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.atom");
	assertEquals(Collections.singletonList(APPLICATION_ATOM_XML), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo");
	request.setParameter("f", "json");
	assertEquals(Collections.singletonList(APPLICATION_JSON), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/resources/foo.gif");
	SimpleUrlHandlerMapping handlerMapping = (SimpleUrlHandlerMapping) this.config.resourceHandlerMapping(
			this.config.mvcUrlPathHelper(), this.config.mvcPathMatcher(),
			this.config.mvcContentNegotiationManager(), this.config.mvcConversionService(),
			this.config.mvcResourceUrlProvider());
	handlerMapping.setApplicationContext(this.context);
	HandlerExecutionChain chain = handlerMapping.getHandler(request);
	assertNotNull(chain);
	ResourceHttpRequestHandler handler = (ResourceHttpRequestHandler) chain.getHandler();
	assertNotNull(handler);
	assertSame(manager, handler.getContentNegotiationManager());
}
 
Example 8
Source File: WebMvcConfigurationSupportExtensionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void contentNegotiation() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo.json");
	NativeWebRequest webRequest = new ServletWebRequest(request);

	RequestMappingHandlerMapping mapping = this.config.requestMappingHandlerMapping();
	ContentNegotiationManager manager = mapping.getContentNegotiationManager();
	assertEquals(Collections.singletonList(APPLICATION_JSON), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.xml");
	assertEquals(Collections.singletonList(APPLICATION_XML), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.rss");
	assertEquals(Collections.singletonList(MediaType.valueOf("application/rss+xml")),
			manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo.atom");
	assertEquals(Collections.singletonList(APPLICATION_ATOM_XML), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/foo");
	request.setParameter("f", "json");
	assertEquals(Collections.singletonList(APPLICATION_JSON), manager.resolveMediaTypes(webRequest));

	request.setRequestURI("/resources/foo.gif");
	SimpleUrlHandlerMapping handlerMapping = (SimpleUrlHandlerMapping) this.config.resourceHandlerMapping();
	handlerMapping.setApplicationContext(this.context);
	HandlerExecutionChain chain = handlerMapping.getHandler(request);
	assertNotNull(chain);
	ResourceHttpRequestHandler handler = (ResourceHttpRequestHandler) chain.getHandler();
	assertNotNull(handler);
	assertSame(manager, handler.getContentNegotiationManager());
}
 
Example 9
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testResources() throws Exception {
	loadBeanDefinitions("mvc-config-resources.xml", 10);

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	ResourceHttpRequestHandler handler = appContext.getBean(ResourceHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE - 1, mapping.getOrder());

	BeanNameUrlHandlerMapping beanNameMapping = appContext.getBean(BeanNameUrlHandlerMapping.class);
	assertNotNull(beanNameMapping);
	assertEquals(2, beanNameMapping.getOrder());

	ResourceUrlProvider urlProvider = appContext.getBean(ResourceUrlProvider.class);
	assertNotNull(urlProvider);

	MappedInterceptor mappedInterceptor = appContext.getBean(MappedInterceptor.class);
	assertNotNull(urlProvider);
	assertEquals(ResourceUrlProviderExposingInterceptor.class, mappedInterceptor.getInterceptor().getClass());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/resources/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof ResourceHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	for (HandlerInterceptor interceptor : chain.getInterceptors()) {
		interceptor.preHandle(request, response, chain.getHandler());
	}
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 10
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testResources() throws Exception {
	loadBeanDefinitions("mvc-config-resources.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
	ContentNegotiationManager manager = mapping.getContentNegotiationManager();

	ResourceHttpRequestHandler handler = appContext.getBean(ResourceHttpRequestHandler.class);
	assertNotNull(handler);
	assertSame(manager, handler.getContentNegotiationManager());

	SimpleUrlHandlerMapping resourceMapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(resourceMapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE - 1, resourceMapping.getOrder());

	BeanNameUrlHandlerMapping beanNameMapping = appContext.getBean(BeanNameUrlHandlerMapping.class);
	assertNotNull(beanNameMapping);
	assertEquals(2, beanNameMapping.getOrder());

	ResourceUrlProvider urlProvider = appContext.getBean(ResourceUrlProvider.class);
	assertNotNull(urlProvider);

	Map<String, MappedInterceptor> beans = appContext.getBeansOfType(MappedInterceptor.class);
	List<Class<?>> interceptors = beans.values().stream()
			.map(mappedInterceptor -> mappedInterceptor.getInterceptor().getClass())
			.collect(Collectors.toList());
	assertThat(interceptors, containsInAnyOrder(ConversionServiceExposingInterceptor.class,
			ResourceUrlProviderExposingInterceptor.class));

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/resources/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = resourceMapping.getHandler(request);
	assertNotNull(chain);
	assertTrue(chain.getHandler() instanceof ResourceHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	for (HandlerInterceptor interceptor : chain.getInterceptors()) {
		interceptor.preHandle(request, response, chain.getHandler());
	}
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 11
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/** WebSphere gives trailing servlet path slashes by default!! */
@Test
public void testViewControllersOnWebSphere() throws Exception {
	loadBeanDefinitions("mvc-config-view-controllers.xml");

	SimpleUrlHandlerMapping mapping2 = appContext.getBean(SimpleUrlHandlerMapping.class);
	SimpleControllerHandlerAdapter adapter = appContext.getBean(SimpleControllerHandlerAdapter.class);

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setMethod("GET");
	request.setRequestURI("/myapp/app/bar");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	request.setAttribute("com.ibm.websphere.servlet.uri_non_decoded", "/myapp/app/bar");
	HandlerExecutionChain chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv2 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("baz", mv2.getViewName());

	request.setRequestURI("/myapp/app/");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());

	request.setRequestURI("/myapp/");
	request.setContextPath("/myapp");
	request.setServletPath("/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());
}
 
Example 12
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testResources() throws Exception {
	loadBeanDefinitions("mvc-config-resources.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class);
	ContentNegotiationManager manager = mapping.getContentNegotiationManager();

	ResourceHttpRequestHandler handler = appContext.getBean(ResourceHttpRequestHandler.class);
	assertNotNull(handler);
	assertSame(manager, handler.getContentNegotiationManager());

	SimpleUrlHandlerMapping resourceMapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(resourceMapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE - 1, resourceMapping.getOrder());

	BeanNameUrlHandlerMapping beanNameMapping = appContext.getBean(BeanNameUrlHandlerMapping.class);
	assertNotNull(beanNameMapping);
	assertEquals(2, beanNameMapping.getOrder());

	ResourceUrlProvider urlProvider = appContext.getBean(ResourceUrlProvider.class);
	assertNotNull(urlProvider);

	Map<String, MappedInterceptor> beans = appContext.getBeansOfType(MappedInterceptor.class);
	List<Class<?>> interceptors = beans.values().stream()
			.map(mappedInterceptor -> mappedInterceptor.getInterceptor().getClass())
			.collect(Collectors.toList());
	assertThat(interceptors, containsInAnyOrder(ConversionServiceExposingInterceptor.class,
			ResourceUrlProviderExposingInterceptor.class));

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/resources/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = resourceMapping.getHandler(request);
	assertNotNull(chain);
	assertTrue(chain.getHandler() instanceof ResourceHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	for (HandlerInterceptor interceptor : chain.getInterceptors()) {
		interceptor.preHandle(request, response, chain.getHandler());
	}
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example 13
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
/** WebSphere gives trailing servlet path slashes by default!! */
@Test
public void testViewControllersOnWebSphere() throws Exception {
	loadBeanDefinitions("mvc-config-view-controllers.xml");

	SimpleUrlHandlerMapping mapping2 = appContext.getBean(SimpleUrlHandlerMapping.class);
	SimpleControllerHandlerAdapter adapter = appContext.getBean(SimpleControllerHandlerAdapter.class);

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setMethod("GET");
	request.setRequestURI("/myapp/app/bar");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	request.setAttribute("com.ibm.websphere.servlet.uri_non_decoded", "/myapp/app/bar");
	HandlerExecutionChain chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv2 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("baz", mv2.getViewName());

	request.setRequestURI("/myapp/app/");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());

	request.setRequestURI("/myapp/");
	request.setContextPath("/myapp");
	request.setServletPath("/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());
}
 
Example 14
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/** WebSphere gives trailing servlet path slashes by default!! */
@Test
public void testViewControllersOnWebSphere() throws Exception {
	loadBeanDefinitions("mvc-config-view-controllers.xml", 19);

	SimpleUrlHandlerMapping mapping2 = appContext.getBean(SimpleUrlHandlerMapping.class);
	SimpleControllerHandlerAdapter adapter = appContext.getBean(SimpleControllerHandlerAdapter.class);

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setMethod("GET");
	request.setRequestURI("/myapp/app/bar");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	request.setAttribute("com.ibm.websphere.servlet.uri_non_decoded", "/myapp/app/bar");
	HandlerExecutionChain chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv2 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("baz", mv2.getViewName());

	request.setRequestURI("/myapp/app/");
	request.setContextPath("/myapp");
	request.setServletPath("/app/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	ModelAndView mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());

	request.setRequestURI("/myapp/");
	request.setContextPath("/myapp");
	request.setServletPath("/");
	chain = mapping2.getHandler(request);
	assertEquals(4, chain.getInterceptors().length);
	assertTrue(chain.getInterceptors()[1] instanceof ConversionServiceExposingInterceptor);
	assertTrue(chain.getInterceptors()[2] instanceof LocaleChangeInterceptor);
	assertTrue(chain.getInterceptors()[3] instanceof ThemeChangeInterceptor);
	mv3 = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
	assertEquals("root", mv3.getViewName());
}