本文整理汇总了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.";
}
示例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.";
}