/** * Merge two PublicSuffixLists * Have to do this because they are unmodifiable * * @since 0.9.20 */ private static PublicSuffixList merge(PublicSuffixList a, PublicSuffixList b) { List<String> ar = a.getRules(); List<String> ae = a.getExceptions(); List<String> br = b.getRules(); List<String> be = b.getExceptions(); List<String> cr = new ArrayList<String>(ar.size() + br.size()); List<String> ce = new ArrayList<String>(ae.size() + be.size()); cr.addAll(ar); cr.addAll(br); ce.addAll(ae); ce.addAll(be); return new PublicSuffixList(cr, ce); }
/** * @since 4.5 */ public PublicSuffixMatcher(final Collection<PublicSuffixList> lists) { Args.notNull(lists, "Domain suffix lists"); this.rules = new ConcurrentHashMap<String, DomainType>(); this.exceptions = new ConcurrentHashMap<String, DomainType>(); for (final PublicSuffixList list: lists) { final DomainType domainType = list.getType(); final List<String> rules = list.getRules(); for (final String rule: rules) { this.rules.put(rule, domainType); } final List<String> exceptions = list.getExceptions(); if (exceptions != null) { for (final String exception: exceptions) { this.exceptions.put(exception, domainType); } } } }
public PublicSuffixDomainFilter( final CommonCookieAttributeHandler handler, final PublicSuffixList suffixList) { Args.notNull(handler, "Cookie handler"); Args.notNull(suffixList, "Public suffix list"); this.handler = handler; this.publicSuffixMatcher = new PublicSuffixMatcher(suffixList.getRules(), suffixList.getExceptions()); }
return new PublicSuffixList(rules, exceptions);
/** * @since 4.5 */ public PublicSuffixMatcher(final Collection<PublicSuffixList> lists) { Args.notNull(lists, "Domain suffix lists"); this.rules = new ConcurrentHashMap<String, DomainType>(); this.exceptions = new ConcurrentHashMap<String, DomainType>(); for (final PublicSuffixList list: lists) { final DomainType domainType = list.getType(); final List<String> rules = list.getRules(); for (final String rule: rules) { this.rules.put(rule, domainType); } final List<String> exceptions = list.getExceptions(); if (exceptions != null) { for (final String exception: exceptions) { this.exceptions.put(exception, domainType); } } } }
/** * Parses the public suffix list format. * When creating the reader from the file, make sure to * use the correct encoding (the original list is in UTF-8). * * @param reader the suffix list. The caller is responsible for closing the reader. * @throws IOException on error while reading from list */ public void parse(final Reader reader) throws IOException { final PublicSuffixList suffixList = parser.parse(reader); filter.setPublicSuffixes(suffixList.getRules()); filter.setExceptions(suffixList.getExceptions()); }
return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
/** * @since 4.5 */ public PublicSuffixMatcher(final Collection<PublicSuffixList> lists) { Args.notNull(lists, "Domain suffix lists"); this.rules = new ConcurrentHashMap<String, DomainType>(); this.exceptions = new ConcurrentHashMap<String, DomainType>(); for (final PublicSuffixList list: lists) { final DomainType domainType = list.getType(); final List<String> rules = list.getRules(); for (final String rule: rules) { this.rules.put(rule, domainType); } final List<String> exceptions = list.getExceptions(); if (exceptions != null) { for (final String exception: exceptions) { this.exceptions.put(exception, domainType); } } } }
/** * Parses the public suffix list format. * When creating the reader from the file, make sure to * use the correct encoding (the original list is in UTF-8). * * @param reader the suffix list. The caller is responsible for closing the reader. * @throws IOException on error while reading from list */ public void parse(final Reader reader) throws IOException { final PublicSuffixList suffixList = parser.parse(reader); filter.setPublicSuffixes(suffixList.getRules()); filter.setExceptions(suffixList.getExceptions()); }
PublicSuffixList list = new PublicSuffixList(Arrays.asList(ADDITIONAL_TLDS), Collections.<String>emptyList()); try { try { if (in != null) in.close(); } catch (IOException ioe) {} DEFAULT_MATCHER = new PublicSuffixMatcher(list.getRules(), list.getExceptions()); if (log.shouldWarn()) log.warn("Loaded " + geoFile + " in " + (System.currentTimeMillis() - begin) + " ms and created list with " + list.getRules().size() + " entries and " + list.getExceptions().size() + " exceptions"); } catch (IOException ex) { log.error("Failure loading public suffix list from " + geoFile, ex);
return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
/** * @since 4.5 */ public PublicSuffixMatcher(final Collection<PublicSuffixList> lists) { Args.notNull(lists, "Domain suffix lists"); this.rules = new ConcurrentHashMap<String, DomainType>(); this.exceptions = new ConcurrentHashMap<String, DomainType>(); for (final PublicSuffixList list: lists) { final DomainType domainType = list.getType(); final List<String> rules = list.getRules(); for (final String rule: rules) { this.rules.put(rule, domainType); } final List<String> exceptions = list.getExceptions(); if (exceptions != null) { for (final String exception: exceptions) { this.exceptions.put(exception, domainType); } } } }
/** * Parses the public suffix list format. * When creating the reader from the file, make sure to * use the correct encoding (the original list is in UTF-8). * * @param reader the suffix list. The caller is responsible for closing the reader. * @throws IOException on error while reading from list */ public void parse(final Reader reader) throws IOException { final PublicSuffixList suffixList = parser.parse(reader); filter.setPublicSuffixes(suffixList.getRules()); filter.setExceptions(suffixList.getExceptions()); }
return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
/** * @since 4.5 */ public PublicSuffixMatcher(final Collection<PublicSuffixList> lists) { Args.notNull(lists, "Domain suffix lists"); this.rules = new ConcurrentHashMap<String, DomainType>(); this.exceptions = new ConcurrentHashMap<String, DomainType>(); for (PublicSuffixList list: lists) { final DomainType domainType = list.getType(); final List<String> rules = list.getRules(); for (String rule: rules) { this.rules.put(rule, domainType); } final List<String> exceptions = list.getExceptions(); if (exceptions != null) { for (String exception: exceptions) { this.exceptions.put(exception, domainType); } } } }
public PublicSuffixDomainFilter( final CommonCookieAttributeHandler handler, final PublicSuffixList suffixList) { Args.notNull(handler, "Cookie handler"); Args.notNull(suffixList, "Public suffix list"); this.handler = handler; this.publicSuffixMatcher = new PublicSuffixMatcher(suffixList.getRules(), suffixList.getExceptions()); this.localDomainMap = createLocalDomainMap(); }
return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
public PublicSuffixDomainFilter( final CommonCookieAttributeHandler handler, final PublicSuffixList suffixList) { Args.notNull(handler, "Cookie handler"); Args.notNull(suffixList, "Public suffix list"); this.handler = handler; this.publicSuffixMatcher = new PublicSuffixMatcher(suffixList.getRules(), suffixList.getExceptions()); this.localDomainMap = createLocalDomainMap(); }
return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
public PublicSuffixDomainFilter( final CommonCookieAttributeHandler handler, final PublicSuffixList suffixList) { Args.notNull(handler, "Cookie handler"); Args.notNull(suffixList, "Public suffix list"); this.handler = handler; this.publicSuffixMatcher = new PublicSuffixMatcher(suffixList.getRules(), suffixList.getExceptions()); this.localDomainMap = createLocalDomainMap(); }