use of org.webpieces.router.impl.routers.CRouter in project webpieces by deanhiller.
the class DomainRouteBuilderImpl method build.
public BRouter build() {
CRouter router = leftOverDomainsBuilder2.buildRouter();
CRouter backendRouter = backendRouteBuilder2.buildRouter();
Map<String, CRouter> domainToRouter = new HashMap<>();
for (Entry<String, AllContentTypesBuilderImpl> entry : domainToRouteBuilder2.entrySet()) {
CRouter router2 = entry.getValue().buildRouter();
domainToRouter.put(entry.getKey(), router2);
}
return new BRouter(router, backendRouter, domainToRouter);
}
use of org.webpieces.router.impl.routers.CRouter in project webpieces by deanhiller.
the class DevelopmentController method notFound.
public Render notFound() {
RouterRequest request = Current.request();
String error = request.getSingleMultipart("webpiecesError");
String url = request.getSingleMultipart("url");
if (url.contains("?")) {
url += "&" + NOT_FOUND_KEY + "=true";
} else {
url += "?" + NOT_FOUND_KEY + "=true";
}
Collection<CRouter> routers = new ArrayList<>();
CRouter router;
BRouter domainRouter = routingHolder.getDomainRouter();
if (request.isBackendRequest) {
router = domainRouter.getBackendRouter();
} else {
router = domainRouter.getLeftOverDomains();
for (CRouter oneRouter : domainRouter.getDomainToRouter().values()) {
routers.add(oneRouter);
}
}
RouterRequest req = (RouterRequest) request.requestState.get(ORIGINAL_REQUEST);
// This is a pain but dynamically build up the html
String routeHtml = build(req.isHttps, req.method, req.relativePath, router);
List<String> paths = new ArrayList<>();
if (req.isHttps) {
paths.add(req.method + " :https : " + req.relativePath);
} else {
paths.add(req.method + " :https : " + req.relativePath);
paths.add(req.method + " :both : " + req.relativePath);
}
return Actions.renderThis("domains", routers, "paths", paths, "routeHtml", routeHtml, "error", error, "url", url);
}
use of org.webpieces.router.impl.routers.CRouter in project webpieces by deanhiller.
the class AllContentTypesBuilderImpl method buildRouter.
public CRouter buildRouter() {
DScopedRouter router = leftOverDomainsBuilder.buildRouter();
Map<String, DContentTypeRouter> domainToRouter = new HashMap<>();
for (Entry<String, ContentTypeBuilderImpl> entry : domainToRouteBuilder.entrySet()) {
DContentTypeRouter router2 = entry.getValue().buildRouter();
domainToRouter.put(entry.getKey(), router2);
}
return new CRouter(router, domainToRouter);
}
Aggregations