本文整理汇总了Java中com.alibaba.dubbo.common.URL.addParameters方法的典型用法代码示例。如果您正苦于以下问题:Java URL.addParameters方法的具体用法?Java URL.addParameters怎么用?Java URL.addParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.common.URL
的用法示例。
在下文中一共展示了URL.addParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_getAdaptiveExtension_inject
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
@Test
public void test_getAdaptiveExtension_inject() throws Exception {
LogUtil.start();
Ext6 ext = ExtensionLoader.getExtensionLoader(Ext6.class).getAdaptiveExtension();
URL url = new URL("p1", "1.2.3.4", 1010, "path1");
url = url.addParameters("ext6", "impl1");
assertEquals("Ext6Impl1-echo-Ext1Impl1-echo", ext.echo(url, "ha"));
Assert.assertTrue("can not find error.", LogUtil.checkNoError());
LogUtil.stop();
url = url.addParameters("simple.ext", "impl2");
assertEquals("Ext6Impl1-echo-Ext1Impl2-echo", ext.echo(url, "ha"));
}
示例2: createMonitor
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
@Override
protected Monitor createMonitor(URL url) {
url = url.setProtocol(url.getParameter(Constants.PROTOCOL_KEY, "dubbo"));
if (url.getPath() == null || url.getPath().length() == 0) {
url = url.setPath(MonitorService.class.getName());
}
String filter = url.getParameter(Constants.REFERENCE_FILTER_KEY);
if (filter == null || filter.length() == 0) {
filter = "";
} else {
filter = filter + ",";
}
url = url.addParameters(Constants.CLUSTER_KEY, "failsafe", Constants.CHECK_KEY, String.valueOf(false),
Constants.REFERENCE_FILTER_KEY, filter + "-monitor");
Invoker<MonitorService> monitorInvoker = protocol.refer(MonitorService.class, url);
MonitorService monitorService = proxyFactory.getProxy(monitorInvoker);
return new DubboMonitor(monitorInvoker, monitorService);
}
示例3: toUrl
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public URL toUrl() {
Map<String, String> serviceName2Map = ConvertUtil.serviceName2Map(getService());
/*if(!serviceName2Map.containsKey(Constants.INTERFACE_KEY)) {
throw new IllegalArgumentException("No interface info");
}
if(!serviceName2Map.containsKey(Constants.VERSION_KEY)) {
throw new IllegalArgumentException("No version info");
}*/
String u = getUrl();
URL url = URL.valueOf(u + "?" + getParameters());
url = url.addParameters(serviceName2Map);
boolean dynamic = isDynamic();
if(!dynamic) {
url = url.addParameter(Constants.DYNAMIC_KEY, false);
}
boolean enabled = isEnabled();
if(enabled != url.getParameter("enabled", true)) {
if(enabled) {
url = url.removeParameter("enabled");
}
else {
url = url.addParameter("enabled", false);
}
}
return url;
}
示例4: toUrl
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public URL toUrl() {
Map<String, String> serviceName2Map = ConvertUtil.serviceName2Map(getService());
/*if(!serviceName2Map.containsKey(Constants.INTERFACE_KEY)) {
throw new IllegalArgumentException("No interface info");
}
if(!serviceName2Map.containsKey(Constants.VERSION_KEY)) {
throw new IllegalArgumentException("No version info");
}*/
String u = getUrl();
URL url = URL.valueOf(u + "?" + getParameters());
url = url.addParameters(serviceName2Map);
boolean dynamic = isDynamic();
if (!dynamic) {
url = url.addParameter(Constants.DYNAMIC_KEY, false);
}
boolean enabled = isEnabled();
if (enabled != url.getParameter("enabled", true)) {
if (enabled) {
url = url.removeParameter("enabled");
} else {
url = url.addParameter("enabled", false);
}
}
return url;
}
示例5: doConfigure
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public URL doConfigure(URL currentUrl, URL configUrl) {
return currentUrl.addParameters(configUrl.getParameters());
}