Specify a middleware that will be called for a matching HTTP TRACE
@param regex A regular expression
@param handlers The middleware to call
186506
public Router trace(@NotNull final Pattern regex, @NotNull final IMiddleware... handlers) {
        addRegEx("TRACE", regex, handlers, traceBindings);
        return this;
    }
159928
public RouteMatcher allWithRegEx(String regex, Handler<HttpServerRequest> handler) {
		addRegEx(regex, handler, getBindings);
		addRegEx(regex, handler, putBindings);
		addRegEx(regex, handler, postBindings);
		addRegEx(regex, handler, deleteBindings);
		addRegEx(regex, handler, optionsBindings);
		addRegEx(regex, handler, headBindings);
		addRegEx(regex, handler, traceBindings);
		addRegEx(regex, handler, connectBindings);
		addRegEx(regex, handler, patchBindings);
		return this;
	}
888093
public Router put(@NotNull final Pattern regex, @NotNull final IMiddleware... handlers) {
        addRegEx("PUT", regex, handlers, putBindings);
        return this;
    }
1251499
public Router put(@NotNull final String pattern, @NotNull final IMiddleware... handlers) {
        addPattern("PUT", pattern, handlers, putBindings);
        return this;
    }
991560
func (m MiddlewareFunc) MethodMatches(tests ...regexp.Regexp) MiddlewareFunc {
	return func(h HandlerFunc) HandlerFunc {
		return func(c *Context) error {
			for _, test := range tests {
				if test.MatchString(c.Request().Request.Method) {
					return m(h)(c)
				}
			}
			return h(c)
		}
	}
}
1254452
private static void registerMiddlewareHandler(Object handler) {
		if(handler instanceof MiddlewareHandler) {
			// register the middleware handler if it is enabled.
			if(((MiddlewareHandler) handler).isEnabled()) {
				((MiddlewareHandler) handler).register();
			}
		}
	}
84664
public RouteMatcher connect(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, connectBindings);
		return this;
	}
173611
def _get(self, url, method, host):
        
        url = host + url
        # Check against known static routes
        route = self.routes_static.get(url)
        method_not_supported = self._invalid_usage(
            'Method {} not allowed for URL {}'.format(
                method, url), status_code=405)
        if route:
            if route.methods and method not in route.methods:
                raise method_not_supported
            match = route.pattern.match(url)
        else:
            route_found = False
            # Move on to testing all regex routes
            for route in self.routes_dynamic[url_hash(url)]:
                match = route.pattern.match(url)
                route_found |= match is not None
                # Do early method checking
                if match and method in route.methods:
                    break
            else:
                # Lastly, check against all regex routes that cannot be hashed
                for route in self.routes_always_check:
                    match = route.pattern.match(url)
                    route_found |= match is not None
                    # Do early method checking
                    if match and method in route.methods:
                        break
                else:
                    # Route was found but the methods didn't match
                    if route_found:
                        raise method_not_supported
                    raise self._not_found(
                        'Requested URL {} not found'.format(url))

        kwargs = {p.name: p.cast(value)
                  for value, p
                  in zip(match.groups(1), route.parameters)}
        route_handler = route.handler
        if hasattr(route_handler, 'handlers'):
            route_handler = route_handler.handlers[method]
        return route_handler, [], kwargs, route.uri
497847
def add_handlers(self, host_pattern: str, host_handlers: _RuleList) -> None:
        
        host_matcher = HostMatches(host_pattern)
        rule = Rule(host_matcher, _ApplicationRouter(self, host_handlers))

        self.default_router.rules.insert(-1, rule)

        if self.default_host is not None:
            self.wildcard_router.add_rules(
                [(DefaultHostMatches(self, host_matcher.host_pattern), host_handlers)]
            )
255354
public Router post(@NotNull final Pattern regex, @NotNull final IMiddleware... handlers) {
        addRegEx("POST", regex, handlers, postBindings);
        return this;
    }
261861
public function to($handler): RegexRouter
    {
        if (! \is_string($handler) && ! \is_object($handler) && ! \is_callable($handler)) {
            throw new Exception\InvalidArgumentException(\sprintf(
                'Invalid handler provided. Expected type is string, object or callable but type of %s given.',
                \gettype($handler)
            ));
        }

        if (null === $this->tmpPattern) {
            throw new Exception\RuntimeException(\sprintf(
                'Cannot map handler %s to a pattern. Please use method route before calling method to',
                \is_object($handler)
                    ? \get_class($handler)
                    : (\is_string($handler) ? $handler : \gettype($handler))
            ));
        }

        $this->patternMap[] = [$this->tmpPattern => $handler];

        $this->tmpPattern = null;

        return $this;
    }
830330
private void checkInstancesMatchRegex(@Nullable String regex) {
        if (regex != null) {
            Pattern pattern = Pattern.compile(regex);
            instances().forEach(resource -> {
                String value = (String) resource.value();
                Matcher matcher = pattern.matcher(value);
                if (!matcher.matches()) {
                    throw TransactionException.regexFailure(this, value, regex);
                }
            });
        }
    }
1105049
public RouteMatcher head(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, headBindings);
		return this;
	}
221380
public Router patch(@NotNull final Pattern regex, @NotNull final IMiddleware... handlers) {
        addRegEx("PATCH", regex, handlers, patchBindings);
        return this;
    }
1214640
@GwtIncompatible("java.util.regex.Pattern")
  public void matches(Pattern regex) {
    if (!regex.matcher(actual()).matches()) {
      failWithActual("expected to match", regex);
    }
  }
405138
public void register(String pattern, HttpRequestHandler handler) {
        registry.register(pattern, handler);
        registry.register(pattern + "/", handler);
    }
601390
public Router patch(@NotNull final String pattern, @NotNull final IMiddleware... handlers) {
        addPattern("PATCH", pattern, handlers, patchBindings);
        return this;
    }