public static String getContextPath(Req req) { return zone(req).entry("contextPath").or(""); }
public static BasicConfig zone(Req req) { Customization custom = Customization.of(req); return zone(custom, req.zone()); }
protected Object page(Req req, Resp resp, Throwable error) { if (error instanceof SecurityException) { resp.model("embedded", req.attr("_embedded", false)); resp.model("req", req); resp.model("loginUri", Msc.specialUri("login")); return resp.code(403).view("login").mvc(true); } else { BasicConfig zone = HttpUtils.zone(req); String home = zone.entry("home").or("/"); Map<String, ?> errorInfo = HttpUtils.getErrorInfo(resp, error); resp.model("req", req); resp.model("error", errorInfo); resp.model("home", home); return resp.mvc(true).view("error"); } }
public Booter entities() { setup.page(uri("entities")) .internal(true) .roles(Role.ADMINISTRATOR) .zone(CENTER) .menu(50, "Application", 30, "Entities") .mvc(new EntitiesHandler()); if (MscOpts.hasJPA()) { for (Class<?> type : JPA.getEntityJavaTypes()) { String uri = GUI.typeUri(type); BasicConfig zone = HttpUtils.zone(setup.custom(), setup.zone()); String contextPath = zone.entry("home").or(uri("")); X.scaffold(type) .internal(true) .baseUri(Msc.uri(contextPath, uri)) .roles(Role.ADMINISTRATOR) .on(setup); } } return this; }
public static BasicConfig zone(Req req) { Customization custom = Customization.of(req); return zone(custom, req.zone()); }
public static String getContextPath(Req req) { return zone(req).entry("contextPath").or(""); }
private void initScreen(Screen screen) { BasicConfig zone = HttpUtils.zone(req); String brand = zone.entry("brand").str().getOrNull(); String title = zone.entry("title").str().getOrNull(); String siteName = req.host(); if (U.isEmpty(siteName) || siteName.equals("localhost") || siteName.startsWith("localhost:") || siteName.equals("127.0.0.1") || siteName.startsWith("127.0.0.1:")) { siteName = "Rapidoid"; } screen.brand(U.or(brand, siteName)); screen.title(U.or(title, siteName)); screen.home(zone.entry("home").str().or("/")); screen.search(zone.entry("search").bool().or(false)); screen.navbar(zone.entry("navbar").bool().or(brand != null)); screen.fluid(zone.entry("fluid").bool().or(false)); String cdn = zone.entry("cdn").or("auto"); if (!"auto".equalsIgnoreCase(cdn)) { screen.cdn(Cls.bool(cdn)); } if (zone.has("menu")) { screen.menu(zone.sub("menu").toMap()); } }
public static void entities(Setup setup) { setup.page(uri("entities")).zone(CENTER).mvc(new EntitiesHandler()); if (MscOpts.hasJPA()) { for (Class<?> type : JPA.getEntityJavaTypes()) { String uri = GUI.typeUri(type); String contextPath = HttpUtils.zone(setup.custom(), setup.zone()).entry("home").or(uri("")); X.scaffold(setup, Msc.uri(contextPath, uri), type); } } }
protected Object page(Req req, Resp resp, Throwable error) { if (error instanceof SecurityException) { resp.model("embedded", req.attr("_embedded", false)); resp.model("req", req); resp.model("loginUri", Msc.specialUri("login")); return resp.code(403).view("login").mvc(true); } else { BasicConfig zone = HttpUtils.zone(req); String home = zone.entry("home").or("/"); Map<String, ?> errorInfo = HttpUtils.getErrorInfo(resp, error); resp.model("req", req); resp.model("error", errorInfo); resp.model("home", home); return resp.mvc(true).view("error"); } }