/** * Creates a new {@link PathMapping} that matches a {@linkplain ServiceRequestContext#path() path} with * the specified regular expression and extracts the values of the named groups. * e.g. {@code "^/users/(?<userId>[0-9]+)$"} will extract the second numeric part of the path into * the {@code "userId"} path parameter. */ static PathMapping ofRegex(String regex) { return ofRegex(Pattern.compile(requireNonNull(regex, "regex"))); }
/** * Creates a new {@link CompositeServiceEntry} whose {@link Service} is bound at the path that matches * the specified regular expression. * * @see PathMapping#ofRegex(Pattern) */ public static <I extends Request, O extends Response> CompositeServiceEntry<I, O> ofRegex(Pattern regex, Service<I, O> service) { return new CompositeServiceEntry<>(PathMapping.ofRegex(regex), service); }
return ofRegex(pathPattern.substring(REGEX.length()));