Search in sources :

Example 1 with RouteTableRouterBuilder

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);
            }
        }
    }
}
Also used : Router(act.route.Router) RouteTableRouterBuilder(act.route.RouteTableRouterBuilder) File(java.io.File)

Aggregations

RouteTableRouterBuilder (act.route.RouteTableRouterBuilder)1 Router (act.route.Router)1 File (java.io.File)1