@Test public void testPathMatchEndWithMultiUrlSeparatorEnabled() { expect(request.getContextPath()).andReturn(CONTEXT_PATH).anyTimes(); expect(request.getRequestURI()).andReturn("/resource/book expect(request.getServletPath()).andReturn("").anyTimes(); expect(request.getPathInfo()).andReturn("/resource/book replay(request); boolean matchEnabled = filter.pathsMatch("/resource/book", request); assertTrue("PathMatch can match URL end with multi Separator", matchEnabled); verify(request); }
protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.length() - 1); } if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path) && path.endsWith(DEFAULT_PATH_SEPARATOR)) { path = path.substring(0, path.length() - 1); } log.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI)); return pathsMatch(path, requestURI); }
PathMatchingFilter extends AdviceFilter implements PathConfigProcessor { protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.length() - 1); } if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path) && path.endsWith(DEFAULT_PATH_SEPARATOR)) { path = path.substring(0, path.length() - 1); } log.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI)); return pathsMatch(path, requestURI); } }
PathMatchingFilter extends AdviceFilter implements PathConfigProcessor { protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.length() - 1); } if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path) && path.endsWith(DEFAULT_PATH_SEPARATOR)) { path = path.substring(0, path.length() - 1); } log.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI)); return pathsMatch(path, requestURI); }  }
PathMatchingFilter extends AdviceFilter implements PathConfigProcessor { protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.length() - 1); } if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path) && path.endsWith(DEFAULT_PATH_SEPARATOR)) { path = path.substring(0, path.length() - 1); } log.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI)); return pathsMatch(path, requestURI); }  Filter processPathConfig(String path, String config); }
PathMatchingFilter extends AdviceFilter implements PathConfigProcessor { protected boolean pathsMatch(String path, ServletRequest request) { String requestURI = getPathWithinApplication(request); if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI) && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) { requestURI = requestURI.substring(0, requestURI.length() - 1); } if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path) && path.endsWith(DEFAULT_PATH_SEPARATOR)) { path = path.substring(0, path.length() - 1); } log.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI)); return pathsMatch(path, requestURI); }  Filter processPathConfig(String path, String config);  }