@Test public void matchPartial() throws Exception { setUpRequest("/foo/bar/baz"); PathPredicate target = new PathPredicate("/foo/bar"); assertTrue(target.resolve(this.exchange)); }
@Override public boolean resolve(HttpServerExchange exchange) { Matcher m = this.template.matcher(exchange.getRelativePath()); if (m.matches()) { int count = m.groupCount(); if (count <= names.size()) { Map<String, String> newone = new HashMap<>(); for (int i = 0; i < count; i++) { newone.put(names.get(i), m.group(i + 1)); } exchange.putAttachment(PARAMS, newone); } return true; } return false; }
PathPredicate implements Predicate { @Override public boolean resolve(HttpServerExchange exchange) { Matcher m = this.template.matcher(exchange.getRelativePath()); if (m.matches()) { int count = m.groupCount(); if (count <= names.size()) { Map<String, String> newone = new HashMap<>(); for (int i = 0; i < count; i++) { newone.put(names.get(i), m.group(i + 1)); } exchange.putAttachment(PARAMS, newone); } return true; } return false; } }
PathPredicate implements Predicate { @Override public boolean resolve(HttpServerExchange exchange) { Matcher m = this.template.matcher(exchange.getRelativePath()); if (m.matches()) { int count = m.groupCount(); if (count <= names.size()) { Map<String, String> newone = new HashMap<>(); for (int i = 0; i < count; i++) { newone.put(names.get(i), m.group(i + 1)); } exchange.putAttachment(PARAMS, newone); } return true; } return false; } PathPredicate(Pattern template);  PathPredicate(String template); }
PathPredicate implements Predicate { @Override public boolean resolve(HttpServerExchange exchange) { Matcher m = this.template.matcher(exchange.getRelativePath()); if (m.matches()) { int count = m.groupCount(); if (count <= names.size()) { Map<String, String> newone = new HashMap<>(); for (int i = 0; i < count; i++) { newone.put(names.get(i), m.group(i + 1)); } exchange.putAttachment(PARAMS, newone); } return true; } return false; } PathPredicate(Pattern template);  PathPredicate(String template); @Override boolean resolve(HttpServerExchange exchange); }
PathPredicate implements Predicate { @Override public boolean resolve(HttpServerExchange exchange) { Matcher m = this.template.matcher(exchange.getRelativePath()); if (m.matches()) { int count = m.groupCount(); if (count <= names.size()) { Map<String, String> newone = new HashMap<>(); for (int i = 0; i < count; i++) { newone.put(names.get(i), m.group(i + 1)); } exchange.putAttachment(PARAMS, newone); } return true; } return false; } PathPredicate(Pattern template);  PathPredicate(String template); @Override boolean resolve(HttpServerExchange exchange); static final AttachmentKey<Map<String, String>> PARAMS; }