当前位置: 首页>>代码示例>>Java>>正文


Java SimpleUrlHandlerMapping.setUrlMap方法代码示例

本文整理汇总了Java中org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.setUrlMap方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleUrlHandlerMapping.setUrlMap方法的具体用法?Java SimpleUrlHandlerMapping.setUrlMap怎么用?Java SimpleUrlHandlerMapping.setUrlMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.web.servlet.handler.SimpleUrlHandlerMapping的用法示例。


在下文中一共展示了SimpleUrlHandlerMapping.setUrlMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
/**
 * Return a handler mapping with the mapped ViewControllers; or {@code null} in case
 * of no registrations.
 */
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<>();
	for (WebMvcWampWebSocketEndpointRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration
				.getMappings();
		for (HttpRequestHandler httpHandler : mappings.keySet()) {
			for (String pattern : mappings.get(httpHandler)) {
				urlMap.put(pattern, httpHandler);
			}
		}
	}
	SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
开发者ID:ralscha,项目名称:wampspring,代码行数:24,代码来源:WebMvcWampEndpointRegistry.java

示例2: getHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
/**
 * Returns a handler mapping with the mapped ViewControllers; or {@code null} in case of no registrations.
 */
protected AbstractHandlerMapping getHandlerMapping() {
	if (registrations.isEmpty()) {
		return null;
	}

	Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
	for (ViewControllerRegistration registration : registrations) {
		urlMap.put(registration.getUrlPath(), registration.getViewController());
	}

	SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
	handlerMapping.setOrder(order);
	handlerMapping.setUrlMap(urlMap);
	return handlerMapping;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:19,代码来源:ViewControllerRegistry.java

示例3: getHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
/**
 * Return a handler mapping with the mapped resource handlers; or {@code null} in case of no registrations.
 */
protected AbstractHandlerMapping getHandlerMapping() {
	if (registrations.isEmpty()) {
		return null;
	}

	Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<String, HttpRequestHandler>();
	for (ResourceHandlerRegistration registration : registrations) {
		for (String pathPattern : registration.getPathPatterns()) {
			ResourceHttpRequestHandler requestHandler = registration.getRequestHandler();
			requestHandler.setServletContext(servletContext);
			requestHandler.setApplicationContext(applicationContext);
			urlMap.put(pathPattern, requestHandler);
		}
	}

	SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
	handlerMapping.setOrder(order);
	handlerMapping.setUrlMap(urlMap);
	return handlerMapping;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:24,代码来源:ResourceHandlerRegistry.java

示例4: handlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Bean
public SimpleUrlHandlerMapping handlerMapping() {
    final SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();

    final Controller root = rootController();
    mapping.setOrder(1);
    mapping.setAlwaysUseFullPath(true);
    mapping.setRootHandler(root);
    final Map urls = new HashMap();
    urls.put("/", root);

    mapping.setUrlMap(urls);
    return mapping;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:15,代码来源:CasWebAppConfiguration.java

示例5: handlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Bean
public SimpleUrlHandlerMapping handlerMapping() {
    SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
    Controller root = this.rootController();
    mapping.setOrder(1);
    mapping.setAlwaysUseFullPath(true);
    mapping.setRootHandler(root);
    Map urls = new HashMap();
    urls.put("/", root);
    mapping.setUrlMap(urls);
    return mapping;
}
 
开发者ID:e-gov,项目名称:TARA-Server,代码行数:13,代码来源:CasWebAppConfiguration.java

示例6: setupUrlMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
public void setupUrlMapping(SimpleUrlHandlerMapping urlHandlerMapping) {
    Map<String, Object> urlMap = new HashMap<String, Object>();
    for (String url : this.processor.getUrlMapping().keySet()) {
        if (url.endsWith("/")) {
            url = url + "**";
        }
        urlMap.put(url, this);
    }
    urlHandlerMapping.setUrlMap(urlMap);
}
 
开发者ID:devefx,项目名称:validator-web,代码行数:11,代码来源:ValidatorController.java

示例7: getHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
/**
 * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the
 * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; or {@code null} if
 * default servlet handling was not been enabled.
 */
protected AbstractHandlerMapping getHandlerMapping() {
	if (handler == null) {
		return null;
	}

	Map<String, HttpRequestHandler> urlMap = new HashMap<String, HttpRequestHandler>();
	urlMap.put("/**", handler);

	SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
	handlerMapping.setOrder(Integer.MAX_VALUE);
	handlerMapping.setUrlMap(urlMap);
	return handlerMapping;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:DefaultServletHandlerConfigurer.java

示例8: getHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
/**
 * Return a handler mapping with the mapped resource handlers; or {@code null} in case of no registrations.
 */
protected AbstractHandlerMapping getHandlerMapping() {
	if (registrations.isEmpty()) {
		return null;
	}

	Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<String, HttpRequestHandler>();
	for (ResourceHandlerRegistration registration : this.registrations) {
		for (String pathPattern : registration.getPathPatterns()) {
			ResourceHttpRequestHandler handler = registration.getRequestHandler();
			handler.setServletContext(this.servletContext);
			handler.setApplicationContext(this.appContext);
			try {
				handler.afterPropertiesSet();
			}
			catch (Exception e) {
				throw new BeanInitializationException("Failed to init ResourceHttpRequestHandler", e);
			}
			urlMap.put(pathPattern, handler);
		}
	}

	SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
	handlerMapping.setOrder(order);
	handlerMapping.setUrlMap(urlMap);
	return handlerMapping;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:ResourceHandlerRegistry.java

示例9: simpleUrlHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
	ResourceHttpRequestHandler handler = new ResourceHttpRequestHandler();
	HashMap<String, ResourceHttpRequestHandler> handlerMap = new HashMap<String, ResourceHttpRequestHandler>();
	handlerMap.put("/resources/**", handler);
	SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
	hm.setUrlMap(handlerMap);
	return hm;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ResourceUrlProviderTests.java

示例10: concreteUrlMappings

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Test
public void concreteUrlMappings() {
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
	mapping.setApplicationContext(new StaticApplicationContext());
	mapping.initApplicationContext();
	this.endpoint.setHandlerMappings(
			Collections.<AbstractUrlHandlerMapping>singletonList(mapping));
	Map<String, Object> result = this.endpoint.invoke();
	assertThat(result).hasSize(1);
	@SuppressWarnings("unchecked")
	Map<String, Object> map = (Map<String, Object>) result.get("/foo");
	assertThat(map.get("type")).isEqualTo("java.lang.Object");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:RequestMappingEndpointTests.java

示例11: beanUrlMappings

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Test
public void beanUrlMappings() {
	StaticApplicationContext context = new StaticApplicationContext();
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
	mapping.setApplicationContext(context);
	mapping.initApplicationContext();
	context.getDefaultListableBeanFactory().registerSingleton("mapping", mapping);
	this.endpoint.setApplicationContext(context);
	Map<String, Object> result = this.endpoint.invoke();
	assertThat(result).hasSize(1);
	@SuppressWarnings("unchecked")
	Map<String, Object> map = (Map<String, Object>) result.get("/foo");
	assertThat(map.get("bean")).isEqualTo("mapping");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:RequestMappingEndpointTests.java

示例12: faviconHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Bean
public SimpleUrlHandlerMapping faviconHandlerMapping() {
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
	mapping.setUrlMap(Collections.singletonMap("**/favicon.ico",
			faviconRequestHandler()));
	return mapping;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:WebMvcAutoConfiguration.java

示例13: concreteUrlMappings

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Test
public void concreteUrlMappings() {
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
	mapping.setApplicationContext(new StaticApplicationContext());
	mapping.initApplicationContext();
	this.endpoint.setHandlerMappings(
			Collections.<AbstractUrlHandlerMapping>singletonList(mapping));
	Map<String, Object> result = this.endpoint.invoke();
	assertEquals(1, result.size());
	@SuppressWarnings("unchecked")
	Map<String, Object> map = (Map<String, Object>) result.get("/foo");
	assertEquals("java.lang.Object", map.get("type"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:RequestMappingEndpointTests.java

示例14: beanUrlMappings

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Test
public void beanUrlMappings() {
	StaticApplicationContext context = new StaticApplicationContext();
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
	mapping.setApplicationContext(context);
	mapping.initApplicationContext();
	context.getDefaultListableBeanFactory().registerSingleton("mapping", mapping);
	this.endpoint.setApplicationContext(context);
	Map<String, Object> result = this.endpoint.invoke();
	assertEquals(1, result.size());
	@SuppressWarnings("unchecked")
	Map<String, Object> map = (Map<String, Object>) result.get("/foo");
	assertEquals("mapping", map.get("bean"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:RequestMappingEndpointTests.java

示例15: faviconHandlerMapping

import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; //导入方法依赖的package包/类
@Bean
public SimpleUrlHandlerMapping faviconHandlerMapping() {
	SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
	mapping.setOrder(Integer.MIN_VALUE + 1);
	mapping.setUrlMap(Collections.singletonMap("**/favicon.ico",
			faviconRequestHandler()));
	return mapping;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:9,代码来源:WebMvcAutoConfiguration.java


注:本文中的org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.setUrlMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。