using webusing afIoc::Injectusing afIoc::Registry** Handles routing URIs to request handler methods.**** If a uri can not be matched to a `Route` then a 404 HttpStatusErr is thrown.constclass Routes {privateconststatic Log log := Utils.getLog(Routes#)privateconst Obj[] routes @Injectprivateconst RouteMatchers routeMatchers @Injectprivateconst ReqestHandlerInvoker handlerInvoker @Injectprivateconst Registry registryinternalnew make(Obj[] routes, |This|? in := null){ in?.call(this)this.routes = routes// routes.each { Env.cur.err.printLine(it) }}internal Obj? processRequest(Uri modRel, Str httpMethod){ normalisedUri := normalise(modRel) response := routes.eachWhile |route| { routeMatch := routeMatchers.matchRoute(route, normalisedUri, httpMethod)if(routeMatch == null)returnnull response := handlerInvoker.invokeHandler(routeMatch)return(response == false) ? null : response}// TODO: if no routes have been defined, route to a default 'BedSheet Welcome' page. Use config to turn on and offif(response == null)throw HttpStatusErr(404, BsMsgs.route404(modRel, httpMethod))return response}private Uri normalise(Uri uri){if(!uri.isPathAbs) uri = `/` + urireturn uri}private WebReq webReq(){ registry.dependencyByType(WebReq#)}}