/** * Export routes from an application. Useful for route analysis, testing, debugging, etc... * * @param app Application to extract/collect routes. * @return Application routes. */ public static List<Definition> exportRoutes(final Jooby app) { @SuppressWarnings("serial") class Success extends RuntimeException { List<Definition> routes; Success(final List<Route.Definition> routes) { this.routes = routes; } } List<Definition> routes = Collections.emptyList(); try { app.start(new String[0], r -> { throw new Success(r); }); } catch (Success success) { routes = success.routes; } catch (Throwable x) { logger(app).debug("Failed bootstrap: {}", app, x); } return routes; }
Logger log = logger(this);
/** * Start an application. Fire the {@link #onStart(Throwing.Runnable)} event and the * {@link #onStarted(Throwing.Runnable)} events. * * @param args Application arguments. */ public void start(final String... args) { try { start(args, null); } catch (Throwable x) { stop(); String msg = "An error occurred while starting the application:"; if (throwBootstrapException) { throw new Err(Status.SERVICE_UNAVAILABLE, msg, x); } else { logger(this).error(msg, x); } } }
Logger log = logger(this);
for (Object it : bag) { Try.run(() -> bindService( logger(this), this.bag, finalConfig,
/** * Export routes from an application. Useful for route analysis, testing, debugging, etc... * * @param app Application to extract/collect routes. * @return Application routes. */ public static List<Definition> exportRoutes(final Jooby app) { @SuppressWarnings("serial") class Success extends RuntimeException { List<Definition> routes; Success(final List<Route.Definition> routes) { this.routes = routes; } } List<Definition> routes = Collections.emptyList(); try { app.start(new String[0], r -> { throw new Success(r); }); } catch (Success success) { routes = success.routes; } catch (Throwable x) { logger(app).debug("Failed bootstrap: {}", app, x); } return routes; }
Logger log = logger(this);
Logger log = logger(this);
/** * Start an application. Fire the {@link #onStart(Throwing.Runnable)} event and the * {@link #onStarted(Throwing.Runnable)} events. * * @param args Application arguments. */ public void start(final String... args) { try { start(args, null); } catch (Throwable x) { stop(); String msg = "An error occurred while starting the application:"; if (throwBootstrapException) { throw new Err(Status.SERVICE_UNAVAILABLE, msg, x); } else { logger(this).error(msg, x); } } }
for (Object it : bag) { Try.run(() -> bindService( logger(this), this.bag, finalConfig,