Search in sources :

Example 1 with MatchableHandlerMapping

use of org.springframework.web.servlet.handler.MatchableHandlerMapping in project spring-security by spring-projects.

the class MvcRequestMatcher method extractUriTemplateVariables.

/*
	 * (non-Javadoc)
	 *
	 * @see org.springframework.security.web.util.matcher.RequestVariablesExtractor#
	 * extractUriTemplateVariables(javax.servlet.http.HttpServletRequest)
	 */
@Override
public Map<String, String> extractUriTemplateVariables(HttpServletRequest request) {
    MatchableHandlerMapping mapping = getMapping(request);
    if (mapping == null) {
        return this.defaultMatcher.extractUriTemplateVariables(request);
    }
    RequestMatchResult result = mapping.match(request, this.pattern);
    return result == null ? Collections.<String, String>emptyMap() : result.extractUriTemplateVariables();
}
Also used : MatchableHandlerMapping(org.springframework.web.servlet.handler.MatchableHandlerMapping) RequestMatchResult(org.springframework.web.servlet.handler.RequestMatchResult)

Example 2 with MatchableHandlerMapping

use of org.springframework.web.servlet.handler.MatchableHandlerMapping in project spring-security by spring-projects.

the class MvcRequestMatcher method matches.

@Override
public boolean matches(HttpServletRequest request) {
    if (this.method != null && !this.method.name().equals(request.getMethod())) {
        return false;
    }
    if (this.servletPath != null && !this.servletPath.equals(request.getServletPath())) {
        return false;
    }
    MatchableHandlerMapping mapping = getMapping(request);
    if (mapping == null) {
        return this.defaultMatcher.matches(request);
    }
    RequestMatchResult matchResult = mapping.match(request, this.pattern);
    return matchResult != null;
}
Also used : MatchableHandlerMapping(org.springframework.web.servlet.handler.MatchableHandlerMapping) RequestMatchResult(org.springframework.web.servlet.handler.RequestMatchResult)

Aggregations

MatchableHandlerMapping (org.springframework.web.servlet.handler.MatchableHandlerMapping)2 RequestMatchResult (org.springframework.web.servlet.handler.RequestMatchResult)2