private boolean matchAuthority(Template input, Status status) { pickMatchingChildren(input.getUsername(), status); pickMatchingChildren(input.getPassword(), status); pickMatchingChildren(input.getHost(), status); pickMatchingChildren(input.getPort(), status); return status.hasCandidates(); }
public void add(Template template, V value) { map.put(template, value); PathNode node = root; // Add the scheme segment to the tree (if any) while descending. node = add(node, template.getScheme()); // Add the authority segments (if any) while descending. node = add(node, template.getUsername()); node = add(node, template.getPassword()); node = add(node, template.getHost()); node = add(node, template.getPort()); // Add the path segments while descending. for (Path segment : template.getPath()) { // If the root already contains a matching segment then descend to that pathNode. // Otherwise create a child pathNode, addValue it to the root and descend to it. // If this new pathNode is a leaf pathNode then set the value. node = add(node, segment); } // Add the fragment (if any) segments while descending. // Note: Doing it this way puts the fragment above the query parameters in the match order. node = add(node, template.getFragment()); if (template.getQuery().isEmpty() && template.getExtra() == null) { // The first template with a value at this node wins. if (node.value == null) { node.template = template; node.value = value; } } else { // Insert a query pathNode into the tree. node.addQuery(template, value); } }