Search in sources :

Example 11 with UrlPathHelper

use of org.springframework.web.util.UrlPathHelper in project spring-framework by spring-projects.

the class WebMvcStompEndpointRegistryTests method handlerMapping.

@Test
public void handlerMapping() {
    SimpleUrlHandlerMapping hm = (SimpleUrlHandlerMapping) this.endpointRegistry.getHandlerMapping();
    assertEquals(0, hm.getUrlMap().size());
    UrlPathHelper pathHelper = new UrlPathHelper();
    this.endpointRegistry.setUrlPathHelper(pathHelper);
    this.endpointRegistry.addEndpoint("/stompOverWebSocket");
    this.endpointRegistry.addEndpoint("/stompOverSockJS").withSockJS();
    //SPR-12403
    assertEquals(1, this.webSocketHandler.getProtocolHandlers().size());
    hm = (SimpleUrlHandlerMapping) this.endpointRegistry.getHandlerMapping();
    assertEquals(2, hm.getUrlMap().size());
    assertNotNull(hm.getUrlMap().get("/stompOverWebSocket"));
    assertNotNull(hm.getUrlMap().get("/stompOverSockJS/**"));
    assertSame(pathHelper, hm.getUrlPathHelper());
}
Also used : UrlPathHelper(org.springframework.web.util.UrlPathHelper) SimpleUrlHandlerMapping(org.springframework.web.servlet.handler.SimpleUrlHandlerMapping) Test(org.junit.Test)

Aggregations

UrlPathHelper (org.springframework.web.util.UrlPathHelper)11 Test (org.junit.Test)6 PathMatcher (org.springframework.util.PathMatcher)4 MockHttpServletRequest (org.springframework.mock.web.test.MockHttpServletRequest)3 AntPathMatcher (org.springframework.util.AntPathMatcher)3 Map (java.util.Map)2 Bean (org.springframework.context.annotation.Bean)2 MultiValueMap (org.springframework.util.MultiValueMap)2 RequestMappingHandlerMapping (org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping)2 ArrayList (java.util.ArrayList)1 ApplicationContext (org.springframework.context.ApplicationContext)1 LocaleContext (org.springframework.context.i18n.LocaleContext)1 SimpleTimeZoneAwareLocaleContext (org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext)1 TimeZoneAwareLocaleContext (org.springframework.context.i18n.TimeZoneAwareLocaleContext)1 StopWatch (org.springframework.util.StopWatch)1 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)1 LocaleContextResolver (org.springframework.web.servlet.LocaleContextResolver)1 LocaleResolver (org.springframework.web.servlet.LocaleResolver)1 SimpleUrlHandlerMapping (org.springframework.web.servlet.handler.SimpleUrlHandlerMapping)1 ResourceUrlProvider (org.springframework.web.servlet.resource.ResourceUrlProvider)1