use of act.route.RouteTableRouterBuilder in project actframework by actframework.
the class App method loadRoutes.
private void loadRoutes() {
loadBuiltInRoutes();
logger.debug("loading app routing table: %s ...", appBase.getPath());
Map<String, List<File>> routes;
if (Act.isProd()) {
routes = RuntimeDirs.routes(this);
} else {
routes = layout().routeTables(base());
}
for (Map.Entry<String, List<File>> entry : routes.entrySet()) {
String npName = entry.getKey();
List<File> routesFileList = entry.getValue();
Router router = S.eq(NamedPort.DEFAULT, npName) ? this.router : this.router(npName);
for (File route : routesFileList) {
if (route.exists() && route.canRead() && route.isFile()) {
List<String> lines = IO.readLines(route);
new RouteTableRouterBuilder(lines).build(router);
}
}
}
}
Aggregations