com.weibo.api.motan.rpc.URL.addParameter()方法的使用及代码示例

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

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

URL.addParameter介绍

暂无

代码示例

代码示例来源:origin: weibocom/motan

private URL toSubscribeUrl(URL url) {
  URL subUrl = url.createCopy();
  subUrl.addParameter(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_SERVICE);
  return subUrl;
}

代码示例来源:origin: weibocom/motan

/**
 * refererURL的扩展参数中,除了application、module外,其他参数被client覆盖, 如果client没有则使用referer的参数
 *
 * @param refererURL
 */
private void mergeClientConfigs(URL refererURL) {
  String application = refererURL.getParameter(URLParamType.application.getName(), URLParamType.application.getValue());
  String module = refererURL.getParameter(URLParamType.module.getName(), URLParamType.module.getValue());
  refererURL.addParameters(this.url.getParameters());
  refererURL.addParameter(URLParamType.application.getName(), application);
  refererURL.addParameter(URLParamType.module.getName(), module);
}

代码示例来源:origin: weibocom/motan

private List<URL> mergeResult(URL url, Map<String, Integer> weights) {
  List<URL> finalResult = new ArrayList<URL>();
  if (weights.size() > 1) {
    // 将所有group及权重拼接成一个rule的URL,并作为第一个元素添加到最终结果中
    URL ruleUrl = new URL("rule", url.getHost(), url.getPort(), url.getPath());
    StringBuilder weightsBuilder = new StringBuilder(64);
    for (Map.Entry<String, Integer> entry : weights.entrySet()) {
      weightsBuilder.append(entry.getKey()).append(':').append(entry.getValue()).append(',');
    }
    ruleUrl.addParameter(URLParamType.weights.getName(), weightsBuilder.deleteCharAt(weightsBuilder.length() - 1).toString());
    finalResult.add(ruleUrl);
  }
  for (String key : weights.keySet()) {
    if (groupServiceCache.containsKey(key)) {
      finalResult.addAll(groupServiceCache.get(key));
    } else {
      URL urlTemp = url.createCopy();
      urlTemp.addParameter(URLParamType.group.getName(), key);
      finalResult.addAll(discoverOneGroup(urlTemp));
      registry.subscribeService(urlTemp, this);
    }
  }
  return finalResult;
}

代码示例来源:origin: weibocom/motan

durl.setHost(hostPort[0].trim());
      durl.setPort(Integer.parseInt(hostPort[1].trim()));
      durl.addParameter(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_SERVICE);
      duBuf.append(StringTools.urlEncode(durl.toFullStr())).append(MotanConstants.COMMA_SEPARATOR);
    regUrl.addParameter(URLParamType.directUrl.getName(), duBuf.toString());
url.addParameter(URLParamType.embed.getName(), StringTools.urlEncode(refUrl.toFullStr()));

代码示例来源:origin: weibocom/motan

u.addParameter(URLParamType.embed.getName(), StringTools.urlEncode(serviceUrl.toFullStr()));
registereUrls.add(u.createCopy());

代码示例来源:origin: weibocom/motan

groupServiceCache.remove(gk);
URL urlTemp = urlCopy.createCopy();
urlTemp.addParameter(URLParamType.group.getName(), gk);
registry.unsubscribeService(urlTemp, this);

代码示例来源:origin: weibocom/motan

public YarExporter(URL url, Provider<T> provider, YarRpcProtocol yarProtocol) {
  super(provider, url);
  EndpointFactory endpointFactory =
      ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
          url.getParameter(URLParamType.endpointFactory.getName(), "netty4yar"));
  // set noheartbeat factory
  String heartbeatFactory = url.getParameter(URLParamType.heartbeatFactory.getName());
  if (heartbeatFactory == null) {
    url.addParameter(URLParamType.heartbeatFactory.getName(), "noHeartbeat");
  }
  // FIXME to avoid parameters ambiguous in weak type language,parameters size of method with
  // same name must be different.
  validateInterface(provider.getInterface());
  server = endpointFactory.createServer(url, yarProtocol.initRequestRouter(url, provider));
}

相关文章