use of org.webpieces.router.api.routes.Routes in project webpieces by deanhiller.
the class RouteLoader method loadAllRoutes.
// protected abstract void verifyRoutes(Collection<Route> allRoutes);
public void loadAllRoutes(WebAppMeta rm, Injector injector, RoutingHolder routingHolder) {
log.info("adding routes");
reverseRoutes = new ReverseRoutes(config, redirectFormation, objectTranslator, reverseTranslator);
ResettingLogic resettingLogic = new ResettingLogic(reverseRoutes, injector);
Boolean enableSeparateBackend = backPortExists.get();
DomainRouteBuilderImpl routerBuilder = new DomainRouteBuilderImpl(routerFutures, futureUtil, routeBuilderLogic, resettingLogic, enableSeparateBackend);
routingHolder.setReverseRouteLookup(reverseRoutes);
routeBuilderLogic.init(reverseRoutes);
List<Routes> all = new ArrayList<>();
// the core application routes
all.addAll(rm.getRouteModules());
List<Plugin> plugins = rm.getPlugins();
if (plugins != null) {
for (Plugin plugin : plugins) {
all.addAll(plugin.getRouteModules());
}
}
for (Routes module : all) {
CurrentRoutes.set(new RouteModuleInfo(module.getClass()));
module.configure(routerBuilder);
CurrentRoutes.set(null);
}
log.info("added all routes to router. Applying Filters");
reverseRoutes.finalSetup();
BRouter domainRouter = routerBuilder.build();
routingHolder.setDomainRouter(domainRouter);
masterRouter.setDomainRouter(domainRouter);
log.info("all filters applied");
compressionCacheSetup.setupCache(routerBuilder.getStaticRoutes());
}
Aggregations