当前位置: 首页>>代码示例>>Java>>正文


Java URL.addParameters方法代码示例

本文整理汇总了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"));
    
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:ExtensionLoader_Adaptive_Test.java

示例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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:19,代码来源:DubboMonitorFactroy.java

示例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;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:31,代码来源:Provider.java

示例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;
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:30,代码来源:Provider.java

示例5: doConfigure

import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public URL doConfigure(URL currentUrl, URL configUrl) {
    return currentUrl.addParameters(configUrl.getParameters());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:4,代码来源:OverrideConfigurator.java


注:本文中的com.alibaba.dubbo.common.URL.addParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。