Package com.alibaba.citrus.util.regex

Examples of com.alibaba.citrus.util.regex.MatchResultSubstitution


            Matcher matcher = this.pattern.matcher(name);

            assertTrue(matcher.find());

            this.subs = new MatchResultSubstitution(matcher);
        }
View Full Code Here


            Matcher matcher = this.pattern.matcher(name);

            assertTrue(matcher.find());

            this.subs = new MatchResultSubstitution(matcher);
        }
View Full Code Here

        return path.matches("^\\w+:.*");
    }

    public static MatchResultSubstitution getMatchResultSubstitution(MatchResult ruleMatchResult,
                                                                     MatchResult conditionMatchResult) {
        return new MatchResultSubstitution("$%", ruleMatchResult, conditionMatchResult);
    }
View Full Code Here

            return match(itemName, matcher);
        }

        private boolean match(String itemName, Matcher matcher) {
            MatchResultSubstitution subs = new MatchResultSubstitution(matcher);

            String type = trimToNull(subs.substitute(typeName));
            String name;

            if (type == null) {
                return false;
            }

            if (moduleName == null) {
                int startIndex = subs.getMatch().end() + 1;

                if (itemName.length() > startIndex) {
                    name = itemName.substring(startIndex);
                } else {
                    return false;
                }
            } else {
                name = subs.substitute(moduleName);
            }

            name = getName(name, itemName);

            if (items.containsKey(itemName)) {
View Full Code Here

            if (negative != matched) {
                log(patternStrings[i]);

                String var = defaultIfNull(this.var, DEFAULT_VAR);
                Substitution subst = new MatchResultSubstitution(negative ? EMPTY_MATCH_RESULT : matcher);

                states.setAttribute(var, subst);

                return true;
            }
View Full Code Here

            if (negative != matched) {
                log(patternStrings[i]);

                String var = defaultIfNull(this.var, DEFAULT_VAR);
                Substitution subst = new MatchResultSubstitution(negative ? EMPTY_MATCH_RESULT : matcher);

                states.setAttribute(var, subst);

                return true;
            }
View Full Code Here

                    continue;
                }
            }

            // 用rule和condition的匹配结果来替换变量
            MatchResultSubstitution resultSubs = getMatchResultSubstitution(ruleMatchResult, conditionMatchResult);

            // 替换path
            log.debug("Rule conditions have been satisfied, starting substitution to uri");

            path = subs.substitute(path, resultSubs);
View Full Code Here

    private boolean findBestMatch() throws ResourceNotFoundException {
        if (resourcesMatcher.matches(resourceName)) {
            ResourceMapping resourceMapping = resourcesMatcher.bestMatchPettern;

            lastMatchedPattern = resourceMapping;
            lastSubstitution = new MatchResultSubstitution(resourcesMatcher.bestMatchResult);

            // 递归查找resource alias,直到一个resource mapping被匹配为止
            if (resourceMapping instanceof ResourceAlias) {
                ResourceAlias alias = (ResourceAlias) resourceMapping;
View Full Code Here

    public Resource getResource() throws ResourceNotFoundException {
        if (filtersMatcher.matches(resourceName)) {
            ResourceFilterMapping filterMapping = filtersMatcher.bestMatchPettern;

            lastMatchedPattern = filterMapping;
            lastSubstitution = new MatchResultSubstitution(filtersMatcher.bestMatchResult);

            log.debug("Resource \"{}\" matched resource-filters pattern: \"{}\"", resourceName,
                      filterMapping.getPatternName());

            ResourceFilterChain root = this; // as ResourceFilterChain
View Full Code Here

            if (matcher.find()) {
                log(patternStrings[i]);

                String var = defaultIfNull(this.var, DEFAULT_VAR);
                Substitution subst = new MatchResultSubstitution(matcher);

                states.setAttribute(var, subst);

                return true;
            }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.regex.MatchResultSubstitution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.