Java Code Examples for javax.net.ssl.SNIMatcher#matches()

The following examples show how to use javax.net.ssl.SNIMatcher#matches() . 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: ServerNameExtension.java    From openjsse with GNU General Public License v2.0 6 votes vote down vote up
private static SNIServerName chooseSni(Collection<SNIMatcher> matchers,
        List<SNIServerName> sniNames) {
    if (sniNames != null && !sniNames.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            int matcherType = matcher.getType();
            for (SNIServerName sniName : sniNames) {
                if (sniName.getType() == matcherType) {
                    if (matcher.matches(sniName)) {
                        return sniName;
                    }

                    // no duplicated entry in the server names list.
                    break;
                }
            }
        }
    }

    return null;
}
 
Example 2
Source File: Java8SslUtils.java    From netty-4.1.22 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
static boolean checkSniHostnameMatch(Collection<?> matchers, String hostname) {
    if (matchers != null && !matchers.isEmpty()) {
        SNIHostName name = new SNIHostName(hostname);
        Iterator<SNIMatcher> matcherIt = (Iterator<SNIMatcher>) matchers.iterator();
        while (matcherIt.hasNext()) {
            SNIMatcher matcher = matcherIt.next();
            // type 0 is for hostname
            if (matcher.getType() == 0 && matcher.matches(name)) {
                return true;
            }
        }
        return false;
    }
    return true;
}
 
Example 3
Source File: ServerNameExtension.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private static SNIServerName chooseSni(Collection<SNIMatcher> matchers,
        List<SNIServerName> sniNames) {
    if (sniNames != null && !sniNames.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            int matcherType = matcher.getType();
            for (SNIServerName sniName : sniNames) {
                if (sniName.getType() == matcherType) {
                    if (matcher.matches(sniName)) {
                        return sniName;
                    }

                    // no duplicated entry in the server names list.
                    break;
                }
            }
        }
    }

    return null;
}
 
Example 4
Source File: ServerNameExtension.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 5
Source File: ServerNameExtension.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 6
Source File: ServerNameExtension.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 7
Source File: ServerNameExtension.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 8
Source File: ServerNameExtension.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 9
Source File: ServerNameExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 10
Source File: ServerNameExtension.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 11
Source File: ServerNameExtension.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 12
Source File: ServerNameExtension.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 13
Source File: ServerNameExtension.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 14
Source File: ServerNameExtension.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 15
Source File: ServerNameExtension.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}
 
Example 16
Source File: ServerNameExtension.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
boolean isMatched(Collection<SNIMatcher> matchers) {
    if (sniMap != null && !sniMap.isEmpty()) {
        for (SNIMatcher matcher : matchers) {
            SNIServerName sniName = sniMap.get(matcher.getType());
            if (sniName != null && (!matcher.matches(sniName))) {
                return false;
            }
        }
    }

    return true;
}