Java Code Examples for com.alibaba.dubbo.common.URL#toMap()

The following examples show how to use com.alibaba.dubbo.common.URL#toMap() . 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: ConditionRouter.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param, Invocation invocation) {
    Map<String, String> sample = url.toMap();
    boolean result = false;
    for (Map.Entry<String, MatchPair> matchPair : condition.entrySet()) {
        String key = matchPair.getKey();
        String sampleValue;
        //get real invoked method name from invocation
        if (invocation != null && (Constants.METHOD_KEY.equals(key) || Constants.METHODS_KEY.equals(key))) {
            sampleValue = invocation.getMethodName();
        } else {
            sampleValue = sample.get(key);
            if (sampleValue == null) {
                sampleValue = sample.get(Constants.DEFAULT_KEY_PREFIX + key);
            }
        }
        if (sampleValue != null) {
            if (!matchPair.getValue().isMatch(sampleValue, param)) {
                return false;
            } else {
                result = true;
            }
        } else {
            //not pass the condition
            if (!matchPair.getValue().matches.isEmpty()) {
                return false;
            } else {
                result = true;
            }
        }
    }
    return result;
}
 
Example 2
Source File: ConditionRouter.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param) {
    Map<String, String> sample = url.toMap();
    for (Map.Entry<String, String> entry : sample.entrySet()) {
        String key = entry.getKey();
        MatchPair pair = condition.get(key);
        if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: ConditionRouter.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param) {
    Map<String, String> sample = url.toMap();
    for (Map.Entry<String, String> entry : sample.entrySet()) {
        String key = entry.getKey();
        MatchPair pair = condition.get(key);
        if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: ConditionRouter.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param) {
    Map<String, String> sample = url.toMap();
    for (Map.Entry<String, String> entry : sample.entrySet()) {
        String key = entry.getKey();
        MatchPair pair = condition.get(key);
        if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
            return false;
        }
    }
    return true;
}
 
Example 5
Source File: ConditionRouter.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param) {
    Map<String, String> sample = url.toMap();
    for (Map.Entry<String, String> entry : sample.entrySet()) {
        String key = entry.getKey();
        MatchPair pair = condition.get(key);
        if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
            return false;
        }
    }
    return true;
}
 
Example 6
Source File: ConditionRouter.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param) {
    Map<String, String> sample = url.toMap();
    for (Map.Entry<String, String> entry : sample.entrySet()) {
        String key = entry.getKey();
        MatchPair pair = condition.get(key);
        if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
            return false;
        }
    }
    return true;
}