本文整理了Java中com.weibo.api.motan.rpc.URL.valueOf()
方法的一些代码示例,展示了URL.valueOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URL.valueOf()
方法的具体详情如下:
包路径:com.weibo.api.motan.rpc.URL
类名称:URL
方法名:valueOf
暂无
代码示例来源:origin: weibocom/motan
private List<URL> parseDirectUrls(String directUrlStr) {
String[] durlArr = MotanConstants.COMMA_SPLIT_PATTERN.split(directUrlStr);
List<URL> directUrls = new ArrayList<URL>();
for (String dus : durlArr) {
URL du = URL.valueOf(StringTools.urlDecode(dus));
if (du != null) {
directUrls.add(du);
}
}
return directUrls;
}
}
代码示例来源:origin: weibocom/motan
defaultParameters.remove("path");
URL u = URL.valueOf(url);
u.addParameters(defaults);
boolean changed = false;
代码示例来源:origin: weibocom/motan
if (StringUtils.isNotBlank(data)) {
try {
newurl = URL.valueOf(data);
} catch (Exception e) {
LoggerUtil.warn(String.format("Found malformed urls from ZookeeperRegistry, path=%s", nodePath), e);
代码示例来源:origin: weibocom/motan
public ClusterSupport(Class<T> interfaceClass, List<URL> registryUrls) {
this.registryUrls = registryUrls;
this.interfaceClass = interfaceClass;
String urlStr = StringTools.urlDecode(registryUrls.get(0).getParameter(URLParamType.embed.getName()));
this.url = URL.valueOf(urlStr);
protocol = getDecorateProtocol(url.getProtocol());
}
代码示例来源:origin: weibocom/motan
/**
* 根据service生成motan使用的
*
* @param service
* @return
*/
public static URL buildUrl(ConsulService service) {
URL url = null;
for (String tag : service.getTags()) {
if (tag.startsWith(ConsulConstants.CONSUL_TAG_MOTAN_URL)) {
String encodeUrl = tag.substring(tag.indexOf("_") + 1);
url = URL.valueOf(StringTools.urlDecode(encodeUrl));
}
}
if (url == null) {
Map<String, String> params = new HashMap<String, String>();
String group = service.getName().substring(ConsulConstants.CONSUL_SERVICE_MOTAN_PRE.length());
params.put(URLParamType.group.getName(), group);
params.put(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_SERVICE);
String protocol = ConsulUtils.getProtocolFromTag(service.getTags().get(0));
url = new URL(protocol, service.getAddress(), service.getPort(),
ConsulUtils.getPathFromServiceId(service.getId()), params);
}
return url;
}
代码示例来源:origin: weibocom/motan
private void unRegister(Collection<URL> registryUrls) {
for (URL url : registryUrls) {
// 不管check的设置如何,做完所有unregistry,做好清理工作
try {
String serviceStr = StringTools.urlDecode(url.getParameter(URLParamType.embed.getName()));
URL serviceUrl = URL.valueOf(serviceStr);
RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension(url.getProtocol());
Registry registry = registryFactory.getRegistry(url);
registry.unregister(serviceUrl);
} catch (Exception e) {
LoggerUtil.warn(String.format("unregister url false:%s", url), e);
}
}
}
代码示例来源:origin: weibocom/motan
@Override
public <T> Exporter<T> export(Class<T> interfaceClass, T ref, List<URL> registryUrls) {
String serviceStr = StringTools.urlDecode(registryUrls.get(0).getParameter(URLParamType.embed.getName()));
URL serviceUrl = URL.valueOf(serviceStr);
// export service
// 利用protocol decorator来增加filter特性
String protocolName = serviceUrl.getParameter(URLParamType.protocol.getName(), URLParamType.protocol.getValue());
Protocol orgProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(protocolName);
Provider<T> provider = getProvider(orgProtocol, ref, serviceUrl, interfaceClass);
Protocol protocol = new ProtocolFilterDecorator(orgProtocol);
Exporter<T> exporter = protocol.export(provider, serviceUrl);
// register service
register(registryUrls, serviceUrl);
return exporter;
}
代码示例来源:origin: com.weibo/motan-registry-zookeeper
if (StringUtils.isNotBlank(data)) {
try {
newurl = URL.valueOf(data);
} catch (Exception e) {
LoggerUtil.warn(String.format("Found malformed urls from ZookeeperRegistry, path=%s", nodePath), e);
代码示例来源:origin: com.weibo/motan-registry-consul
/**
* 根据service生成motan使用的
*
* @param service
* @return
*/
public static URL buildUrl(ConsulService service) {
URL url = null;
for (String tag : service.getTags()) {
if (tag.startsWith(ConsulConstants.CONSUL_TAG_MOTAN_URL)) {
String encodeUrl = tag.substring(tag.indexOf("_") + 1);
url = URL.valueOf(StringTools.urlDecode(encodeUrl));
}
}
if (url == null) {
Map<String, String> params = new HashMap<String, String>();
String group = service.getName().substring(ConsulConstants.CONSUL_SERVICE_MOTAN_PRE.length());
params.put(URLParamType.group.getName(), group);
params.put(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_SERVICE);
String protocol = ConsulUtils.getProtocolFromTag(service.getTags().get(0));
url = new URL(protocol, service.getAddress(), service.getPort(),
ConsulUtils.getPathFromServiceId(service.getId()), params);
}
return url;
}
内容来源于网络,如有侵权,请联系作者删除!