org.apache.dubbo.common.URL.getParameterAndDecoded()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.apache.dubbo.common.URL.getParameterAndDecoded()方法的一些代码示例,展示了URL.getParameterAndDecoded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URL.getParameterAndDecoded()方法的具体详情如下:
包路径:org.apache.dubbo.common.URL
类名称:URL
方法名:getParameterAndDecoded

URL.getParameterAndDecoded介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public String getParameterAndDecoded(String key) {
  return super.getParameterAndDecoded(key);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public String getParameterAndDecoded(String key) {
  return super.getParameterAndDecoded(key);
}

代码示例来源:origin: apache/incubator-dubbo

public String getParameterAndDecoded(String key) {
  return getParameterAndDecoded(key, null);
}

代码示例来源:origin: apache/incubator-dubbo

public String getParameterAndDecoded(String key) {
  return getParameterAndDecoded(key, null);
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * get rule from url parameters.
 */
private String getRule(URL url) {
  String vRule = url.getParameterAndDecoded(Constants.RULE_KEY);
  if (StringUtils.isEmpty(vRule)) {
    throw new IllegalStateException("route rule can not be empty.");
  }
  return vRule;
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * get rule from url parameters.
 */
private String getRule(URL url) {
  String vRule = url.getParameterAndDecoded(Constants.RULE_KEY);
  if (StringUtils.isEmpty(vRule)) {
    throw new IllegalStateException("route rule can not be empty.");
  }
  return vRule;
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * Get the address of the providerUrl through the url of the invoker
 *
 * @param originInvoker
 * @return
 */
private URL getProviderUrl(final Invoker<?> originInvoker) {
  String export = originInvoker.getUrl().getParameterAndDecoded(EXPORT_KEY);
  if (export == null || export.length() == 0) {
    throw new IllegalArgumentException("The registry export url is null! registry: " + originInvoker.getUrl());
  }
  return URL.valueOf(export);
}

代码示例来源:origin: apache/incubator-dubbo

/**
 * Get the address of the providerUrl through the url of the invoker
 *
 * @param originInvoker
 * @return
 */
private URL getProviderUrl(final Invoker<?> originInvoker) {
  String export = originInvoker.getUrl().getParameterAndDecoded(EXPORT_KEY);
  if (export == null || export.length() == 0) {
    throw new IllegalArgumentException("The registry export url is null! registry: " + originInvoker.getUrl());
  }
  return URL.valueOf(export);
}

代码示例来源:origin: apache/incubator-dubbo

public URL getUrlParameter(String key) {
  URL u = getUrls().get(key);
  if (u != null) {
    return u;
  }
  String value = getParameterAndDecoded(key);
  if (StringUtils.isEmpty(value)) {
    return null;
  }
  u = URL.valueOf(value);
  getUrls().put(key, u);
  return u;
}

代码示例来源:origin: apache/incubator-dubbo

public URL getUrlParameter(String key) {
  URL u = getUrls().get(key);
  if (u != null) {
    return u;
  }
  String value = getParameterAndDecoded(key);
  if (StringUtils.isEmpty(value)) {
    return null;
  }
  u = URL.valueOf(value);
  getUrls().put(key, u);
  return u;
}

代码示例来源:origin: apache/incubator-dubbo

public RegistryDirectory(Class<T> serviceType, URL url) {
  super(url);
  if (serviceType == null) {
    throw new IllegalArgumentException("service type is null.");
  }
  if (url.getServiceKey() == null || url.getServiceKey().length() == 0) {
    throw new IllegalArgumentException("registry serviceKey is null.");
  }
  this.serviceType = serviceType;
  this.serviceKey = url.getServiceKey();
  this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY));
  this.overrideDirectoryUrl = this.directoryUrl = turnRegistryUrlToConsumerUrl(url);
  String group = directoryUrl.getParameter(Constants.GROUP_KEY, "");
  this.multiGroup = group != null && ("*".equals(group) || group.contains(","));
}

代码示例来源:origin: apache/incubator-dubbo

public RegistryDirectory(Class<T> serviceType, URL url) {
  super(url);
  if (serviceType == null) {
    throw new IllegalArgumentException("service type is null.");
  }
  if (url.getServiceKey() == null || url.getServiceKey().length() == 0) {
    throw new IllegalArgumentException("registry serviceKey is null.");
  }
  this.serviceType = serviceType;
  this.serviceKey = url.getServiceKey();
  this.queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY));
  this.overrideDirectoryUrl = this.directoryUrl = turnRegistryUrlToConsumerUrl(url);
  String group = directoryUrl.getParameter(Constants.GROUP_KEY, "");
  this.multiGroup = group != null && ("*".equals(group) || group.contains(","));
}

代码示例来源:origin: apache/incubator-dubbo

public AbstractDirectory(URL url, URL consumerUrl, RouterChain<T> routerChain) {
  if (url == null) {
    throw new IllegalArgumentException("url == null");
  }
  if (url.getProtocol().equals(Constants.REGISTRY_PROTOCOL)) {
    Map<String, String> queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY));
    this.url = url.addParameters(queryMap).removeParameter(Constants.MONITOR_KEY);
  } else {
    this.url = url;
  }
  this.consumerUrl = consumerUrl;
  setRouterChain(routerChain);
}

代码示例来源:origin: apache/incubator-dubbo

public AbstractDirectory(URL url, URL consumerUrl, RouterChain<T> routerChain) {
  if (url == null) {
    throw new IllegalArgumentException("url == null");
  }
  if (url.getProtocol().equals(Constants.REGISTRY_PROTOCOL)) {
    Map<String, String> queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(Constants.REFER_KEY));
    this.url = url.addParameters(queryMap).removeParameter(Constants.MONITOR_KEY);
  } else {
    this.url = url;
  }
  this.consumerUrl = consumerUrl;
  setRouterChain(routerChain);
}

代码示例来源:origin: apache/incubator-dubbo

public ConditionRouter(URL url) {
  this.url = url;
  this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
  this.force = url.getParameter(Constants.FORCE_KEY, false);
  this.enabled = url.getParameter(Constants.ENABLED_KEY, true);
  init(url.getParameterAndDecoded(Constants.RULE_KEY));
}

代码示例来源:origin: apache/incubator-dubbo

public ConditionRouter(URL url) {
  this.url = url;
  this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
  this.force = url.getParameter(Constants.FORCE_KEY, false);
  this.enabled = url.getParameter(Constants.ENABLED_KEY, true);
  init(url.getParameterAndDecoded(Constants.RULE_KEY));
}

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
  url = url.setProtocol(url.getParameter(REGISTRY_KEY, DEFAULT_REGISTRY)).removeParameter(REGISTRY_KEY);
  Registry registry = registryFactory.getRegistry(url);
  if (RegistryService.class.equals(type)) {
    return proxyFactory.getInvoker((T) registry, type, url);
  }
  // group="a,b" or group="*"
  Map<String, String> qs = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY));
  String group = qs.get(Constants.GROUP_KEY);
  if (group != null && group.length() > 0) {
    if ((COMMA_SPLIT_PATTERN.split(group)).length > 1 || "*".equals(group)) {
      return doRefer(getMergeableCluster(), registry, type, url);
    }
  }
  return doRefer(cluster, registry, type, url);
}

代码示例来源:origin: apache/incubator-dubbo

@Override
@SuppressWarnings("unchecked")
public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
  url = url.setProtocol(url.getParameter(REGISTRY_KEY, DEFAULT_REGISTRY)).removeParameter(REGISTRY_KEY);
  Registry registry = registryFactory.getRegistry(url);
  if (RegistryService.class.equals(type)) {
    return proxyFactory.getInvoker((T) registry, type, url);
  }
  // group="a,b" or group="*"
  Map<String, String> qs = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY));
  String group = qs.get(Constants.GROUP_KEY);
  if (group != null && group.length() > 0) {
    if ((COMMA_SPLIT_PATTERN.split(group)).length > 1 || "*".equals(group)) {
      return doRefer(getMergeableCluster(), registry, type, url);
    }
  }
  return doRefer(cluster, registry, type, url);
}

代码示例来源:origin: apache/incubator-dubbo

return result;
} else if (force) {
  logger.warn("The route result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + ", router: " + url.getParameterAndDecoded(Constants.RULE_KEY));
  return result;

代码示例来源:origin: apache/incubator-dubbo

return result;
} else if (force) {
  logger.warn("The route result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + ", router: " + url.getParameterAndDecoded(Constants.RULE_KEY));
  return result;

相关文章

微信公众号

最新文章

更多