public void route(String pathSpec, Class<? extends Controller> cls) { List<String> res = parseRoute(pathSpec); router.add(HTTP.GET, res.get(R_PATH), cls, res.get(R_ACTION), res.subList(R_PARAMS, res.size())); }
public void route(String pathSpec, Class<? extends Controller> cls) { List<String> res = parseRoute(pathSpec); router.add(HTTP.GET, res.get(R_PATH), cls, res.get(R_ACTION), res.subList(R_PARAMS, res.size())); }
/** * Setup of a webapp serving route. * @param method the http method for the route * @param pathSpec the path spec in the form of /controller/action/:args etc. * @param cls the controller class * @param action the controller method */ public void route(HTTP method, String pathSpec, Class<? extends Controller> cls, String action) { List<String> res = parseRoute(pathSpec); router.add(method, res.get(R_PATH), cls, action, res.subList(R_PARAMS, res.size())); }
public void route(String pathSpec, Class<? extends Controller> cls) { List<String> res = parseRoute(pathSpec); router.add(HTTP.GET, res.get(R_PATH), cls, res.get(R_ACTION), res.subList(R_PARAMS, res.size())); }
/** * Setup of a webapp serving route. * @param method the http method for the route * @param pathSpec the path spec in the form of /controller/action/:args etc. * @param cls the controller class * @param action the controller method */ public void route(HTTP method, String pathSpec, Class<? extends Controller> cls, String action) { List<String> res = parseRoute(pathSpec); router.add(method, res.get(R_PATH), cls, action, res.subList(R_PARAMS, res.size())); }
/** * Setup of a webapp serving route. * @param method the http method for the route * @param pathSpec the path spec in the form of /controller/action/:args etc. * @param cls the controller class * @param action the controller method */ public void route(HTTP method, String pathSpec, Class<? extends Controller> cls, String action) { List<String> res = parseRoute(pathSpec); router.add(method, res.get(R_PATH), cls, action, res.subList(R_PARAMS, res.size())); }
private Dest resolveAction(WebApp.HTTP method, Dest dest, String path) { if (dest.prefix.length() == 1) { return null; } checkState(!isGoodMatch(dest, path), dest.prefix); checkState(SLASH.countIn(path) > 1, path); List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); return add(method, pjoin("", controller, action), dest.controllerClass, action, null); } }
private Dest resolveAction(WebApp.HTTP method, Dest dest, String path) { if (dest.prefix.length() == 1) { return null; } checkState(!isGoodMatch(dest, path), dest.prefix); checkState(SLASH.countIn(path) > 1, path); List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); return add(method, pjoin("", controller, action), dest.controllerClass, action, null); } }
private Dest resolveAction(WebApp.HTTP method, Dest dest, String path) { if (dest.prefix.length() == 1) { return null; } checkState(!isGoodMatch(dest, path), dest.prefix); checkState(SLASH.countIn(path) > 1, path); List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); return add(method, pjoin("", controller, action), dest.controllerClass, action, null); } }
private Dest resolveDefault(WebApp.HTTP method, String path) { List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); // NameController is encouraged default Class<? extends Controller> cls = find(Controller.class, join(controller, "Controller")); if (cls == null) { cls = find(Controller.class, controller); } if (cls == null) { throw new WebAppException(join(path, ": controller for ", controller, " not found")); } return add(method, defaultPrefix(controller, action), cls, action, null); }
private Dest resolveDefault(WebApp.HTTP method, String path) { List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); // NameController is encouraged default Class<? extends Controller> cls = find(Controller.class, join(controller, "Controller")); if (cls == null) { cls = find(Controller.class, controller); } if (cls == null) { throw new WebAppException(join(path, ": controller for ", controller, " not found")); } return add(method, defaultPrefix(controller, action), cls, action, null); }
private Dest resolveDefault(WebApp.HTTP method, String path) { List<String> parts = WebApp.parseRoute(path); String controller = parts.get(WebApp.R_CONTROLLER); String action = parts.get(WebApp.R_ACTION); // NameController is encouraged default Class<? extends Controller> cls = find(Controller.class, join(controller, "Controller")); if (cls == null) { cls = find(Controller.class, controller); } if (cls == null) { throw new WebAppException(join(path, ": controller for ", controller, " not found")); } return add(method, defaultPrefix(controller, action), cls, action, null); }