Package com.opensymphony.xwork2.util

Examples of com.opensymphony.xwork2.util.WildcardHelper


     * @param classPackageName name of class package
     * @return false if class package is on the {@link #excludePackages} list
     */
    protected boolean checkExcludePackages(String classPackageName) {
        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here


    protected boolean includeClassNameInActionScan(String className) {

        String classPackageName = StringUtils.substringBeforeLast(className, ".");

        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
View Full Code Here

     * @param classPackageName name of class package
     * @return false if class package is on the {@link #excludePackages} list
     */
    protected boolean checkExcludePackages(String classPackageName) {
        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here

     * @param classPackageName name of class package
     * @return false if class package is on the {@link #excludePackages} list
     */
    protected boolean checkExcludePackages(String classPackageName) {
        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here

     * @param classPackageName name of class package
     * @return false if class package is on the {@link #excludePackages} list
     */
    protected boolean checkExcludePackages(String classPackageName) {
        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here

     * @deprecated Since 2.1, use {@link #ActionConfigMatcher(PatternMatcher, Map, boolean)} instead
     */
    @Deprecated public ActionConfigMatcher(Map<String, ActionConfig> configs,
            boolean looseMatch) {

        this(new WildcardHelper(), configs, looseMatch);
    }
View Full Code Here

        Set<String> names = new HashSet<String>();
        names.add("/bar");
        names.add("/foo/*/bar");
        names.add("/foo/*");
        names.add("/foo/*/jim/*");
        NamespaceMatcher matcher = new NamespaceMatcher(new WildcardHelper(), names);
        assertEquals(3, matcher.compiledPatterns.size());

        assertNull(matcher.match("/asd"));
        assertEquals("/foo/*", matcher.match("/foo/23").getPattern());
        assertEquals("/foo/*/bar", matcher.match("/foo/23/bar").getPattern());
View Full Code Here

     * @deprecated Since 2.1, use {@link #ActionConfigMatcher(PatternMatcher, Map, boolean)} instead
     */
    @Deprecated public ActionConfigMatcher(Map<String, ActionConfig> configs,
            boolean looseMatch) {

        this(new WildcardHelper(), configs, looseMatch);
    }
View Full Code Here

     * @param classPackageName name of class package
     * @return false if class package is on the {@link #excludePackages} list
     */
    protected boolean checkExcludePackages(String classPackageName) {
        if(excludePackages != null && excludePackages.length > 0) {
            WildcardHelper wildcardHelper = new WildcardHelper();

            //we really don't care about the results, just the boolean
            Map<String, String> matchMap = new HashMap<String, String>();

            for(String packageExclude : excludePackages) {
                int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
                if(wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
                    return false;
                }
            }
        }
        return true;
View Full Code Here

                return false;
            }
        }
       
        // test the methods using pattern matching
        WildcardHelper wildcard = new WildcardHelper();
        String methodCopy ;
        if (method == null ) { // no method specified
            methodCopy = "";
        }
        else {
            methodCopy = new String(method);
        }
        for (String pattern : includeMethods) {
            if (pattern.contains("*")) {
                int[] compiledPattern = wildcard.compilePattern(pattern);
                HashMap<String,String> matchedPatterns = new HashMap<String, String>();
                boolean matches = wildcard.match(matchedPatterns, methodCopy, compiledPattern);
                if (matches) {
                    return true; // run it, includeMethods takes precedence
                }
            }
            else {
                if (pattern.equals(methodCopy)) {
                    return true; // run it, includeMethods takes precedence
                }
            }
        }
        if (excludeMethods.contains("*") ) {
            return false;
        }

        // CHECK ME: Previous implementation used include method
        for ( String pattern : excludeMethods) {
            if (pattern.contains("*")) {
                int[] compiledPattern = wildcard.compilePattern(pattern);
                HashMap<String,String> matchedPatterns = new HashMap<String, String>();
                boolean matches = wildcard.match(matchedPatterns, methodCopy, compiledPattern);
                if (matches) {
                    // if found, and wasn't included earlier, don't run it
                    return false;
                }
            }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.util.WildcardHelper

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.