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


Java UrlUtils类代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.UrlUtils的典型用法代码示例。如果您正苦于以下问题:Java UrlUtils类的具体用法?Java UrlUtils怎么用?Java UrlUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UrlUtils类属于com.alibaba.dubbo.common.utils包,在下文中一共展示了UrlUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExporter

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) {
    Exporter<?> result = null;

    if (!key.getServiceKey().contains("*")) {
        result = map.get(key.getServiceKey());
    } else {
        if (map != null && !map.isEmpty()) {
            for (Exporter<?> exporter : map.values()) {
                if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) {
                    result = exporter;
                    break;
                }
            }
        }
    }

    if (result == null) {
        return null;
    } else if (ProtocolUtils.isGeneric(
        result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) {
        return null;
    } else {
        return result;
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:26,代码来源:InjvmProtocol.java

示例2: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
protected void notify(List<URL> urls) {
    if(urls == null || urls.isEmpty()) return;
    
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();
        
        if(! UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }
        
        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " +  urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:23,代码来源:AbstractRegistry.java

示例3: registered

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
protected void registered(URL url) {
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL key = entry.getKey();
        if (UrlUtils.isMatch(key, url)) {
            Set<URL> urls = received.get(key);
            if (urls == null) {
                received.putIfAbsent(key, new ConcurrentHashSet<URL>());
                urls = received.get(key);
            }
            urls.add(url);
            List<URL> list = toList(urls);
            for (NotifyListener listener : entry.getValue()) {
                notify(key, listener, list);
                synchronized (listener) {
                    listener.notify();
                }
            }
        }
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:21,代码来源:MulticastRegistry.java

示例4: getMatchedUrls

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
private List<URL> getMatchedUrls(List<URL> configuratorUrls, URL currentSubscribe) {
    List<URL> result = new ArrayList<URL>();
    for (URL url : configuratorUrls) {
        URL overrideUrl = url;
        // 兼容旧版本
        if (url.getParameter(Constants.CATEGORY_KEY) == null
                && Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
            overrideUrl = url.addParameter(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
        }

        //检查是不是要应用到当前服务上
        if (UrlUtils.isMatch(currentSubscribe, overrideUrl)) {
            result.add(url);
        }
    }
    return result;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:RegistryProtocol.java

示例5: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
protected void notify(List<URL> urls) {
    if (urls == null || urls.isEmpty()) return;

    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();

        if (!UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }

        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " + urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:23,代码来源:AbstractRegistry.java

示例6: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            // dubbo://10.0.45.75:20880/com.geek.dubbo.test.api.UserService?anyhost=true&application=dubbo-test-provider1
            // &dubbo=2.0.0&generic=false&group=GroupA&interface=com.geek.dubbo.test.api.UserService&methods=getUser,createUser
            // &pid=1526&revision=1.0.0&side=provider&timeout=1000000&timestamp=1446621673431&version=1.0.0
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:spccold,项目名称:dubbo-comments,代码行数:19,代码来源:ZookeeperRegistry.java

示例7: getExporter

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) {
    Exporter<?> result = null;

    if (!key.getServiceKey().contains("*")) {
        result = map.get(key.getServiceKey());
    } else {
        if (map != null && !map.isEmpty()) {
            for (Exporter<?> exporter : map.values()) {
                if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) {
                    result = exporter;
                    break;
                }
            }
        }
    }

    if (result == null) {
        return null;
    } else if (ProtocolUtils.isGeneric(
            result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) {
        return null;
    } else {
        return result;
    }
}
 
开发者ID:linux-china,项目名称:dubbo3,代码行数:26,代码来源:InjvmProtocol.java

示例8: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
protected void notify(List<URL> urls) {
    if(urls == null || urls.isEmpty()) return;
    
    for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
        URL url = entry.getKey();
        //判断(消费者URL)url和(提供者URL)urls.get(0)是否匹配
        if(! UrlUtils.isMatch(url, urls.get(0))) {
            continue;
        }
        
        Set<NotifyListener> listeners = entry.getValue();
        if (listeners != null) {
            for (NotifyListener listener : listeners) {
                try {
                    notify(url, listener, filterEmpty(url, urls));
                } catch (Throwable t) {
                    logger.error("Failed to notify registry event, urls: " +  urls + ", cause: " + t.getMessage(), t);
                }
            }
        }
    }
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:23,代码来源:AbstractRegistry.java

示例9: toUrlsWithoutEmpty

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
/**
 * 根据consumerUrl提供的信息获得其匹配的providerUrl,获得了providerUrl就获得了服务端的address,就可以调用了。
 * @param consumer
 * @param providers
 * @return
 */
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
	List<URL> urls = new ArrayList<URL>();
    if (providers != null && providers.size() > 0) {
        for (String provider : providers) {
            provider = URL.decode(provider);
            if (provider.contains("://")) {
                URL url = URL.valueOf(provider);
                if (UrlUtils.isMatch(consumer, url)) {
                    urls.add(url);
                }
            }
        }
    }
    return urls;
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:22,代码来源:ZookeeperRegistry.java

示例10: getExporter

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) {
	Exporter<?> result = null;

	if (!key.getServiceKey().contains("*")) {
		result = map.get(key.getServiceKey());
	} else {
		if (map != null && !map.isEmpty()) {
			for (Exporter<?> exporter : map.values()) {
				if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) {
					result = exporter;
					break;
				}
			}
		}
	}

	if (result == null) {
		return null;
	} else if (ProtocolUtils.isGeneric(result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) {
		return null;
	} else {
		return result;
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:25,代码来源:InjvmProtocol.java

示例11: notify

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
protected void notify(List<URL> urls) {
	if (urls == null || urls.isEmpty())
		return;

	for (Map.Entry<URL, Set<NotifyListener>> entry : getSubscribed().entrySet()) {
		URL url = entry.getKey();

		if (!UrlUtils.isMatch(url, urls.get(0))) {
			continue;
		}

		Set<NotifyListener> listeners = entry.getValue();
		if (listeners != null) {
			for (NotifyListener listener : listeners) {
				try {
					notify(url, listener, filterEmpty(url, urls));
				} catch (Throwable t) {
					log.error("Failed to notify registry event, urls: " + urls + ", cause: " + t.getMessage(),
							t);
				}
			}
		}
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:25,代码来源:AbstractRegistry.java

示例12: getMatchedUrls

import com.alibaba.dubbo.common.utils.UrlUtils; //导入依赖的package包/类
private List<URL> getMatchedUrls(List<URL> configuratorUrls, URL currentSubscribe) {
	List<URL> result = new ArrayList<URL>();
	for (URL url : configuratorUrls) {
		URL overrideUrl = url;
		// 兼容旧版本
		if (url.getParameter(Constants.CATEGORY_KEY) == null
				&& Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
			overrideUrl = url.addParameter(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
		}

		// 检查是不是要应用到当前服务上
		if (UrlUtils.isMatch(currentSubscribe, overrideUrl)) {
			result.add(url);
		}
	}
	return result;
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:18,代码来源:RegistryProtocol.java


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