use of act.route.Router in project actframework by actframework.
the class ApiManager method load.
public void load(App app) {
LOGGER.info("start compiling API book");
Router router = app.router();
AppConfig config = app.config();
Set<Class> controllerClasses = new HashSet<>();
load(router, null, config, controllerClasses);
for (NamedPort port : app.config().namedPorts()) {
router = app.router(port);
load(router, port, config, controllerClasses);
}
if (Act.isDev()) {
exploreDescriptions(controllerClasses);
}
}
use of act.route.Router in project actframework by actframework.
the class App method initRouters.
private void initRouters() {
router = new Router(this);
moreRouters = new HashMap<>();
List<NamedPort> ports = config().namedPorts();
for (NamedPort port : ports) {
moreRouters.put(port, new Router(this, port.name()));
}
if (config.cliOverHttp()) {
NamedPort cliOverHttp = new NamedPort(AppConfig.PORT_CLI_OVER_HTTP, config.cliOverHttpPort());
moreRouters.put(cliOverHttp, new Router(this, AppConfig.PORT_CLI_OVER_HTTP));
}
}
use of act.route.Router in project actframework by actframework.
the class App method loadBuiltInRoutes.
private void loadBuiltInRoutes() {
router().addMapping(GET, "/asset/", new ResourceGetter("asset"), RouteSource.BUILD_IN);
router().addMapping(GET, "/~/asset/", new ResourceGetter("asset/~act"), RouteSource.BUILD_IN);
router().addMapping(GET, "/webjars/", new ResourceGetter("META-INF/resources/webjars"), RouteSource.BUILD_IN);
router().addContext("act.", "/~");
if (config.cliOverHttp()) {
Router router = router(AppConfig.PORT_CLI_OVER_HTTP);
router.addMapping(GET, "/asset/", new ResourceGetter("asset"), RouteSource.BUILD_IN);
}
SecureTicketCodec secureTicketCodec = config.secureTicketCodec();
SecureTicketHandler secureTicketHandler = new SecureTicketHandler(secureTicketCodec);
router().addMapping(GET, "/~/ticket", secureTicketHandler);
}
use of act.route.Router 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