Java Code Examples for com.alibaba.dubbo.common.URL#addParameters()
The following examples show how to use
com.alibaba.dubbo.common.URL#addParameters() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtensionLoader_Adaptive_Test.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@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")); }
Example 2
Source File: DubboMonitorFactroy.java From dubbox with Apache License 2.0 | 6 votes |
@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); }
Example 3
Source File: ExtensionLoader_Adaptive_Test.java From dubbox with Apache License 2.0 | 6 votes |
@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")); }
Example 4
Source File: ExtensionLoader_Adaptive_Test.java From dubbox with Apache License 2.0 | 6 votes |
@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")); }
Example 5
Source File: ExtensionLoader_Adaptive_Test.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@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")); }
Example 6
Source File: DubboMonitorFactroy.java From dubbox with Apache License 2.0 | 6 votes |
@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); }
Example 7
Source File: DubboMonitorFactroy.java From dubbox with Apache License 2.0 | 6 votes |
@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); }
Example 8
Source File: ExtensionLoader_Adaptive_Test.java From dubbox with Apache License 2.0 | 6 votes |
@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")); }
Example 9
Source File: DubboMonitorFactory.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@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); }
Example 10
Source File: Provider.java From dubbox with Apache License 2.0 | 5 votes |
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; }
Example 11
Source File: Provider.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
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; }
Example 12
Source File: Provider.java From open-capacity-platform with Apache License 2.0 | 5 votes |
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; }
Example 13
Source File: Provider.java From dubbox with Apache License 2.0 | 5 votes |
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; }
Example 14
Source File: Provider.java From dubbo3 with Apache License 2.0 | 5 votes |
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; }
Example 15
Source File: Provider.java From dubbox with Apache License 2.0 | 5 votes |
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; }
Example 16
Source File: OverrideConfigurator.java From dubbox with Apache License 2.0 | 4 votes |
public URL doConfigure(URL currentUrl, URL configUrl) { return currentUrl.addParameters(configUrl.getParameters()); }
Example 17
Source File: OverrideConfigurator.java From dubbo3 with Apache License 2.0 | 4 votes |
public URL doConfigure(URL currentUrl, URL configUrl) { return currentUrl.addParameters(configUrl.getParameters()); }
Example 18
Source File: OverrideConfigurator.java From dubbox with Apache License 2.0 | 4 votes |
public URL doConfigure(URL currentUrl, URL configUrl) { return currentUrl.addParameters(configUrl.getParameters()); }
Example 19
Source File: OverrideConfigurator.java From dubbox with Apache License 2.0 | 4 votes |
public URL doConfigure(URL currentUrl, URL configUrl) { return currentUrl.addParameters(configUrl.getParameters()); }
Example 20
Source File: OverrideConfigurator.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
@Override public URL doConfigure(URL currentUrl, URL configUrl) { return currentUrl.addParameters(configUrl.getParameters()); }