當前位置: 首頁>>代碼示例>>Java>>正文


Java PathMatcher.match方法代碼示例

本文整理匯總了Java中org.springframework.util.PathMatcher.match方法的典型用法代碼示例。如果您正苦於以下問題:Java PathMatcher.match方法的具體用法?Java PathMatcher.match怎麽用?Java PathMatcher.match使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.PathMatcher的用法示例。


在下文中一共展示了PathMatcher.match方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isAllowed

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
private boolean isAllowed(String resourcePath) {
	if (resourcePath.matches(PROTECTED_PATH)) {
		return false;
	}
	PathMatcher pathMatcher = new AntPathMatcher();
	for (String pattern : allowedResourcePaths) {
		if (pathMatcher.match(pattern, resourcePath)) {
			return true;
		}
	}
	return false;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:13,代碼來源:ResourceServlet.java

示例2: match

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
@Override
public boolean match(String url, PathMatcher pathMatcher) {
	return pathMatcher.match(urlMatcher, url);
}
 
開發者ID:digitalfondue,項目名稱:lavagna,代碼行數:5,代碼來源:SecurityConfiguration.java

示例3: hasMatch

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
private boolean hasMatch(PathMatcher pathMatcher, String path,
		List<String> patterns) {
	for (String pattern : patterns) {
		if (pathMatcher.match(pattern, path)) {
			return true;
		}
	}
	return false;
}
 
開發者ID:spring-io,項目名稱:artifactory-resource,代碼行數:10,代碼來源:PathFilter.java

示例4: isAllowed

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
private boolean isAllowed(String resourcePath) {
	if (resourcePath.matches(PROTECTED_PATH)) {
		return false;
	}
	PathMatcher pathMatcher = new AntPathMatcher();
	for (String pattern : (allowedResourcePaths == null ? ALLOWED_RESOURCE_PATHS : allowedResourcePaths)) {
		if (pathMatcher.match(pattern, resourcePath)) {
			return true;
		}
	}
	return false;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:13,代碼來源:ResourceController.java

示例5: findImportedBundleMatchingResource

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
/**
 * Searches for the given pattern inside the imported bundle. This translates to pattern matching on the imported
 * packages.
 * 
 * @param importedBundle imported bundle
 * @param path path used for pattern matching
 * @param foundPaths collection of found results
 */
@SuppressWarnings("unchecked")
private void findImportedBundleMatchingResource(final ImportedBundle importedBundle, String rootPath, String path,
		final Collection<String> foundPaths) throws IOException {

	final boolean trace = logger.isTraceEnabled();

	String[] packages = importedBundle.getImportedPackages();

	if (trace)
		logger.trace("Searching path [" + path + "] on imported pkgs " + ObjectUtils.nullSafeToString(packages)
				+ "...");

	final boolean startsWithSlash = rootPath.startsWith(FOLDER_SEPARATOR);

	for (int i = 0; i < packages.length; i++) {
		// transform the package name into a path
		String pkg = packages[i].replace(DOT, SLASH) + SLASH;

		if (startsWithSlash) {
			pkg = FOLDER_SEPARATOR + pkg;
		}

		final PathMatcher matcher = getPathMatcher();
		// if the imported package matches the path
		if (matcher.matchStart(path, pkg)) {
			Bundle bundle = importedBundle.getBundle();
			// 1. look at the Bundle jar root
			Enumeration<String> entries = bundle.getEntryPaths(pkg);
			while (entries != null && entries.hasMoreElements()) {
				String entry = entries.nextElement();
				if (startsWithSlash)
					entry = FOLDER_SEPARATOR + entry;

				if (matcher.match(path, entry)) {
					if (trace)
						logger.trace("Found entry [" + entry + "]");
					foundPaths.add(entry);
				}
			}
			// 2. Do a Bundle-Classpath lookup (since the jar might use a different classpath)
			Collection<String> cpMatchingPaths = findBundleClassPathMatchingPaths(bundle, path);
			foundPaths.addAll(cpMatchingPaths);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:54,代碼來源:OsgiBundleResourcePatternResolver.java

示例6: matcherAnt

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
public static  boolean matcherAnt(String reg,String str){
    PathMatcher matcher = new AntPathMatcher();
     return matcher.match(reg, str);
}
 
開發者ID:MinsxCloud,項目名稱:minsx-java-example,代碼行數:5,代碼來源:RegexA.java

示例7: main

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
/**
 * @param args
 */
public static void main(String[] args) {
	PathMatcher pathMatcher =  new AntPathMatcher();
	boolean result = pathMatcher.match("admin/**/*.html", "admin/sdfsf.html");
	System.out.println("result = " + result);
}
 
開發者ID:8090boy,項目名稱:gomall.la,代碼行數:9,代碼來源:PathMatcherTest.java

示例8: findImportedBundleMatchingResource

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
/**
 * Searches for the given pattern inside the imported bundle. This
 * translates to pattern matching on the imported packages.
 * 
 * @param importedBundle imported bundle
 * @param path path used for pattern matching
 * @param foundPaths collection of found results
 */
private void findImportedBundleMatchingResource(final ImportedBundle importedBundle, String rootPath, String path,
		final Collection foundPaths) throws IOException {

	final boolean trace = logger.isTraceEnabled();

	String[] packages = importedBundle.getImportedPackages();

	if (trace)
		logger.trace("Searching path [" + path + "] on imported pkgs " + ObjectUtils.nullSafeToString(packages)
				+ "...");

	final boolean startsWithSlash = rootPath.startsWith(FOLDER_SEPARATOR);

	for (int i = 0; i < packages.length; i++) {
		// transform the package name into a path
		String pkg = packages[i].replace(DOT, SLASH) + SLASH;

		if (startsWithSlash) {
			pkg = FOLDER_SEPARATOR + pkg;
		}

		final PathMatcher matcher = getPathMatcher();
		// if the imported package matches the path
		if (matcher.matchStart(path, pkg)) {
			Bundle bundle = importedBundle.getBundle();
			// 1. look at the Bundle jar root
			Enumeration entries = bundle.getEntryPaths(pkg);
			while (entries != null && entries.hasMoreElements()) {
				String entry = (String) entries.nextElement();
				if (startsWithSlash)
					entry = FOLDER_SEPARATOR + entry;

				if (matcher.match(path, entry)) {
					if (trace)
						logger.trace("Found entry [" + entry + "]");
					foundPaths.add(entry);
				}
			}
			// 2. Do a Bundle-Classpath lookup (since the jar might use a different classpath)
			Collection cpMatchingPaths = findBundleClassPathMatchingPaths(bundle, path);
			foundPaths.addAll(cpMatchingPaths);
		}
	}
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:53,代碼來源:OsgiBundleResourcePatternResolver.java

示例9: matcherAnt

import org.springframework.util.PathMatcher; //導入方法依賴的package包/類
/**
 * ANT匹配字符串
 * @param str 需要匹配的字符串
 * @param reg ANT表達式
 * @return 是否匹配到
 */
public static  boolean matcherAnt(String reg,String str){
    PathMatcher matcher = new AntPathMatcher();
    return matcher.match(reg, str);
}
 
開發者ID:MinsxCloud,項目名稱:minsx-java-example,代碼行數:11,代碼來源:RegexC.java


注:本文中的org.springframework.util.PathMatcher.match方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。