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


Java CollectionUtils.split方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.CollectionUtils.split方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.split方法的具体用法?Java CollectionUtils.split怎么用?Java CollectionUtils.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.common.utils.CollectionUtils的用法示例。


在下文中一共展示了CollectionUtils.split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doExecute

import com.alibaba.dubbo.common.utils.CollectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
    protected String doExecute(Map<String,Object> context) throws Exception {
    	Map<String, String[]> params = request.getParameterMap();
        if (params == null || params.size() == 0) {
        	throw new IllegalArgumentException("The url parameters is null! Usage: " + request.getRequestURL().toString() + "?com.xxx.XxxService=http://" + request.getRemoteAddr() + "/xxxService?application=xxx&foo1=123");
        }
        Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
        for (Map.Entry<String, String[]> entry : params.entrySet()) {
            if (entry.getKey() != null && entry.getKey().length() > 0
                    && entry.getValue() != null && entry.getValue().length > 0
                    && entry.getValue()[0] != null && entry.getValue()[0].length() > 0) {
            	if (! currentUser.hasServicePrivilege(entry.getKey())) {
					throw new IllegalStateException("The user " + currentUser.getUsername() + " have no privilege of service " + entry.getKey());
				}
            	String serviceName = entry.getKey();
            	Map<String, String> url2query = CollectionUtils.split(Arrays.asList(entry.getValue()), "?");
            	// check whether url contain application info
            	for(Map.Entry<String, String> e : url2query.entrySet()) {
            	   Map<String, String> query = StringUtils.parseQueryString(e.getValue()); 
            	   String app = query.get("application");
            	   if(StringUtils.isBlank(app)) {
            	       throw new IllegalStateException("No application for service(" + serviceName + "): "
            	               + e.getKey() + "?" + e.getValue());
            	   }
            	}
                map.put(serviceName, url2query);
            }
        }
        if (map.size() > 0) {
//        	providerDAO.register(registryCache.getCurrentRegistry(), request.getRemoteAddr(), operatorAddress, operator, map, false, true);
        }
        return "Register " + map.size() + " services.";
    }
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:34,代码来源:Register.java

示例2: doExecute

import com.alibaba.dubbo.common.utils.CollectionUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
    protected String doExecute(Map<String, Object> context) throws Exception {
        Map<String, String[]> params = request.getParameterMap();
        if (params == null || params.size() == 0) {
            throw new IllegalArgumentException("The url parameters is null! Usage: " + request.getRequestURL().toString() + "?com.xxx.XxxService=http://" + request.getRemoteAddr() + "/xxxService?application=xxx&foo1=123");
        }
        Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
        for (Map.Entry<String, String[]> entry : params.entrySet()) {
            if (entry.getKey() != null && entry.getKey().length() > 0
                    && entry.getValue() != null && entry.getValue().length > 0
                    && entry.getValue()[0] != null && entry.getValue()[0].length() > 0) {
                if (!currentUser.hasServicePrivilege(entry.getKey())) {
                    throw new IllegalStateException("The user " + currentUser.getUsername() + " have no privilege of service " + entry.getKey());
                }
                String serviceName = entry.getKey();
                Map<String, String> url2query = CollectionUtils.split(Arrays.asList(entry.getValue()), "?");
                // check whether url contain application info
                for (Map.Entry<String, String> e : url2query.entrySet()) {
                    Map<String, String> query = StringUtils.parseQueryString(e.getValue());
                    String app = query.get("application");
                    if (StringUtils.isBlank(app)) {
                        throw new IllegalStateException("No application for service(" + serviceName + "): "
                                + e.getKey() + "?" + e.getValue());
                    }
                }
                map.put(serviceName, url2query);
            }
        }
        if (map.size() > 0) {
//        	providerDAO.register(registryCache.getCurrentRegistry(), request.getRemoteAddr(), operatorAddress, operator, map, false, true);
        }
        return "Register " + map.size() + " services.";
    }
 
开发者ID:l1325169021,项目名称:github-test,代码行数:34,代码来源:Register.java


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