List of usage examples for org.springframework.util PathMatcher extractPathWithinPattern
String extractPathWithinPattern(String pattern, String path);
From source file:com.bstek.dorado.web.resolver.UriResolverMapping.java
@Override protected Object lookupHandler(String urlPath, HttpServletRequest request) throws Exception { Map<String, Object> handlerMap = getHandlerMap(); Object handler = handlerMap.get(urlPath); String bestPatternMatch = urlPath; String pathWithinMapping = urlPath; if (handler == null) { PathMatcher pathMatcher = getPathMatcher(); for (Iterator<String> it = handlerMap.keySet().iterator(); it.hasNext();) { String registeredPath = it.next(); if (pathMatcher.match(registeredPath, urlPath)) { request.setAttribute("originalUrlPath", urlPath); handler = handlerMap.get(registeredPath); bestPatternMatch = registeredPath; pathWithinMapping = pathMatcher.extractPathWithinPattern(bestPatternMatch, urlPath); break; }/* w w w . j ava 2s . c om*/ } } if (handler != null) { PathMatcher pathMatcher = getPathMatcher(); Map<String, String> uriTemplateVariables = new LinkedHashMap<String, String>(); uriTemplateVariables.putAll(pathMatcher.extractUriTemplateVariables(bestPatternMatch, urlPath)); if (logger.isDebugEnabled()) { logger.debug("URI Template variables for request [" + urlPath + "] are " + uriTemplateVariables); } handler = buildPathExposingHandler(handler, bestPatternMatch, pathWithinMapping, uriTemplateVariables); } return handler; }