@Test public void testDomainNameMatching() throws URISyntaxException { Assert.assertTrue(MatchRule.ALL.matchHost("security.wildfly.org").matches(new URI("remote+http: Assert.assertFalse(MatchRule.ALL.matchHost("security.wildfly").matches(new URI("remote+http: Assert.assertFalse(MatchRule.ALL.matchHost("wildfly.org").matches(new URI("remote+http: Assert.assertTrue(MatchRule.ALL.matchHost("*.wildfly.org").matches(new URI("remote+http: Assert.assertTrue(MatchRule.ALL.matchHost("*.wildfly.org").matches(new URI("remote+http: Assert.assertFalse(MatchRule.ALL.matchHost("*.test.wildfly.org").matches(new URI("remote+http: }
@Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } }
MatchHostRule extends MatchRule { @Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } } }
MatchHostRule extends MatchRule { @Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } } MatchHostRule(final MatchRule parent, String hostSpec); }
MatchHostRule extends MatchRule { @Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } } MatchHostRule(final MatchRule parent, String hostSpec); @Override boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority); @Override String getMatchHost(); @Override boolean isHostMatched(); @Override int hashCode(); }
MatchHostRule extends MatchRule { @Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } } MatchHostRule(final MatchRule parent, String hostSpec); @Override boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority); @Override String getMatchHost(); @Override boolean isHostMatched(); @Override int hashCode();  }