@Override public Object call() { List<Object> routes = U.list(); Set<Route> appRoutes = On.setup().routes().allExceptInternal(); Set<Route> internalRoutes = On.setup().routes().allInternal(); internalRoutes.addAll(Admin.setup().routes().allInternal()); routes.add(div(h3("Application routes:"), routesOf(appRoutes, true))); routes.add(div(h3("Internal routes:"), routesOf(internalRoutes, true))); return multi(routes); }
public NParamMethodHandler(FastHttp http, HttpRoutes routes, RouteOptions options, Method method, NParamLambda lambda) { super(http, options); this.method = method; Class<?>[] paramTypes = method.getParameterTypes(); String[] paramNames; if (lambda != null) { paramNames = Cls.getLambdaParameterNames(lambda); paramTypes = Arr.sub(paramTypes, paramTypes.length - paramNames.length, paramTypes.length); } else { paramNames = Cls.getMethodParameterNames(method); } Annotation[][] annotations = method.getParameterAnnotations(); this.paramRetrievers = new ParamRetriever[paramTypes.length]; String par = ""; for (int i = 0; i < paramRetrievers.length; i++) { paramRetrievers[i] = ParamRetrievers.createParamRetriever(routes.custom(), paramTypes[i], paramNames[i], annotations[i]); if (i > 0) { par += ", "; } par += paramTypes[i].getSimpleName() + " " + paramNames[i]; } paramsAsStr = "(" + par + ")"; }
static void register(SetupImpl setup, String verb, String path, RouteOptions options, NParamLambda lambda) { HttpHandler handler = HttpHandlers.from(setup, lambda, options); setup.routes().on(verb, path, handler); setup.autoActivate(); }
private List<Route> findPublishableRoutes() { // admin zone routes are considered private, don't publish them Set<Route> nonAdmin = setup.routes().allExceptInternal(); return Do.findIn(nonAdmin).all(this::isPublishable); }
@Override public Object call() throws Exception { List<Object> routes = U.list(); Set<Route> appRoutes = On.setup().routes().allNonAdmin(); Set<Route> adminRoutes = On.setup().routes().allAdmin(); adminRoutes.addAll(Admin.setup().routes().allAdmin()); routes.add(div(h3("Application routes:"), routesOf(appRoutes, true))); routes.add(div(h3("Admin routes:"), routesOf(adminRoutes, true))); return multi(routes); }
public static void welcome(Setup setup) { if (!setup.routes().hasRouteOrResource(HttpVerb.GET, "/")) { On.get("/").view("_welcome").zone(CENTER).mvc(new WelcomeHandler()); } }
static void registerStatic(SetupImpl setup, String verb, String path, RouteOptions options, byte[] response) { setup.routes().on(verb, path, new StaticHttpHandler(options, response)); setup.autoActivate(); }
static void registerPredefined(SetupImpl setup, String verb, String path, RouteOptions options, Object response) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new PredefinedResponseHandler(http, routes, options, response)); setup.autoActivate(); }
public NParamMethodHandler(FastHttp http, HttpRoutes routes, RouteOptions options, Method method, NParamLambda lambda) { super(http, options); this.method = method; Class<?>[] paramTypes = method.getParameterTypes(); String[] paramNames; if (lambda != null) { paramNames = Cls.getLambdaParameterNames(lambda); paramTypes = Arr.sub(paramTypes, paramTypes.length - paramNames.length, paramTypes.length); } else { paramNames = Cls.getMethodParameterNames(method); } Annotation[][] annotations = method.getParameterAnnotations(); this.paramRetrievers = new ParamRetriever[paramTypes.length]; String par = ""; for (int i = 0; i < paramRetrievers.length; i++) { paramRetrievers[i] = ParamRetrievers.createParamRetriever(routes.custom(), paramTypes[i], paramNames[i], annotations[i]); if (i > 0) { par += ", "; } par += paramTypes[i].getSimpleName() + " " + paramNames[i]; } paramsAsStr = "(" + par + ")"; }
static void register(SetupImpl setup, String verb, String path, RouteOptions options, Callable<?> handler) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new CallableHttpHandler(http, routes, options, handler)); setup.autoActivate(); }
static void register(SetupImpl setup, String verb, String path, RouteOptions options, Method method, Object instance) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new MethodReqHandler(http, routes, options, method, instance)); setup.autoActivate(); }
static void register(Setup setup, String verb, String path, RouteOptions options, NParamLambda lambda) { HttpHandler handler = HttpHandlers.from(setup, lambda, options); setup.routes().on(verb, path, handler); setup.autoActivate(); }
static void registerStatic(Setup setup, String verb, String path, RouteOptions options, byte[] response) { setup.routes().on(verb, path, new StaticHttpHandler(options, response)); setup.autoActivate(); }
static void registerPredefined(Setup setup, String verb, String path, RouteOptions options, Object response) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new PredefinedResponseHandler(http, routes, options, response)); setup.autoActivate(); }
static void register(Setup setup, String verb, String path, RouteOptions options, Method method, Object instance) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new MethodReqHandler(http, routes, options, method, instance)); setup.autoActivate(); }
static void register(Setup setup, String verb, String path, RouteOptions options, Callable<?> handler) { FastHttp http = setup.http(); HttpRoutes routes = setup.routes(); routes.on(verb, path, new CallableHttpHandler(http, routes, options, handler)); setup.autoActivate(); }