/** * Append route that matches the HTTP GET method: * * <pre> * get(req {@literal ->} { * return "hello"; * }); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.OneArgHandler handler) { return get("/", handler); }
/** * Append a route that matches the HTTP GET method: * * <pre> * get((req, rsp) {@literal ->} { * rsp.send(something); * }); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.Handler handler) { return get("/", handler); }
/** * Append route that matches HTTP GET method: * * <pre> * get(() {@literal ->} * "hello" * ); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.ZeroArgHandler handler) { return get("/", handler); }
@Override public void configure(final Env env, final Config conf, final Binder binder) { String baseurl = this.baseurl.orElseGet(() -> { if (conf.hasPath(SITEMAP_BASEURL)) { return conf.getString(SITEMAP_BASEURL); } else { Config $ = conf.getConfig("application"); return "http://" + $.getString("host") + ":" + $.getString("port") + $.getString("path"); } }); wpp.accept(binder); env.router().get(path, new SitemapHandler(path, NOT_ME.and(filter), gen(baseurl))); }
env.router().get(checkConfig.getString("path"), () -> response);
compiler.patterns().forEach(pattern -> routes.get(pattern, handler));
router.get("/login", new Pac4jLoginForm(Route.normalize(contextPath + callbackPath))) .name("pac4j(LoginForm)");
router.get(api, req -> { Config conf = req.require(Config.class); Map<String, Object> hash = conf.getConfig("raml").root().unwrapped(); } else { byte[] ramlString = readRaml(options.file); router.get(api, req -> { return Results.ok(ramlString).type("text/yml"); }); + "\"></raml-console-loader>"); router.get(options.path, req -> { String page = Optional.ofNullable(req.param("theme").value(options.theme)) .map(theme -> index
static void install(final Env env, final Config conf) { String path = conf.getString("crash.httpshell.path"); Router router = env.router(); router.get(path + "/{cmd:.*}", router.promise("direct", (req, deferred) -> { MediaType type = req.accepts(MediaType.json) .map(it -> MediaType.json) .orElse(MediaType.html); PluginContext ctx = req.require(PluginContext.class); ShellFactory shellFactory = ctx.getPlugin(ShellFactory.class); Shell shell = shellFactory.create(null); String cmd = req.param("cmd").value().replaceAll("/", " "); ShellProcess process = shell.createProcess(cmd); ShellProcessContext spc = new SimpleProcessContext( result -> deferred.resolve(result.type(type))); process.execute(spc); })); }
router.get(options.path + "/swagger.json", options.path + "/swagger.yml", req -> { Map<String, Object> hash = conf.getConfig("swagger").root().unwrapped(); Swagger base = Json.mapper().convertValue(hash, Swagger.class); configurer.accept(swagger); router.get(options.path + "/swagger.json", options.path + "/swagger.yml", req -> { boolean json = req.path().endsWith(".json"); if (json) { options.tryIt ? "</head>" : "<style> .try-out {display: none;}</style></head>"); router.get(options.path, req -> { String page = Optional.ofNullable(req.param("theme").value(options.theme)) .map(theme -> index.replace("<style>", "<link rel=\"stylesheet\" " router.get(options.redoc, () -> Results.ok(redoc).type(MediaType.html));
String rootpath = Route.normalize(conf.getString("application.path") + path); routes.get(path, req -> Results.ok("<!DOCTYPE HTML>\n" + "<html>\n" + "<head>\n" +
/** * Append route that matches the HTTP GET method: * * <pre> * get(req {@literal ->} { * return "hello"; * }); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.OneArgHandler handler) { return get("/", handler); }
/** * Append a route that matches the HTTP GET method: * * <pre> * get((req, rsp) {@literal ->} { * rsp.send(something); * }); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.Handler handler) { return get("/", handler); }
/** * Append route that matches HTTP GET method: * * <pre> * get(() {@literal ->} * "hello" * ); * </pre> * * @param handler A handler to execute. * @return A new route definition. */ @Nonnull default Route.Definition get(Route.ZeroArgHandler handler) { return get("/", handler); }
router.get("/").handler((request) -> { vertx.eventBus().send("processMessage", null, (heavyDutyResponse) -> { if (heavyDutyResponse.succeeded()) {
public static void main(String[] args) { Vertx vertx = Vertx.vertx(); Router router = Router.router(vertx); router.get("/").handler((request) -> { // When hub receives request, it dispatches it to one of the Spokes String requestUUID = UUID.randomUUID().toString(); vertx.eventBus().send("processMessage", requestUUID, (spokeResponse) -> { if (spokeResponse.succeeded()) { request.response().end("Request " + requestUUID + ":" + spokeResponse.result().body().toString()); } // Handle errors }); }); // We create two Spokes vertx.deployVerticle(new SpokeVerticle()); vertx.deployVerticle(new SpokeVerticle()); // This is your Hub vertx.createHttpServer().requestHandler(router::accept).listen(8888); }
env.router().get(checkConfig.getString("path"), () -> response);
compiler.patterns().forEach(pattern -> routes.get(pattern, handler));
router.get(api, req -> { Config conf = req.require(Config.class); Map<String, Object> hash = conf.getConfig("raml").root().unwrapped(); } else { byte[] ramlString = readRaml(options.file); router.get(api, req -> { return Results.ok(ramlString).type("text/yml"); }); + "\"></raml-console-loader>"); router.get(options.path, req -> { String page = Optional.ofNullable(req.param("theme").value(options.theme)) .map(theme -> index
router.get(options.path + "/swagger.json", options.path + "/swagger.yml", req -> { Map<String, Object> hash = conf.getConfig("swagger").root().unwrapped(); Swagger base = Json.mapper().convertValue(hash, Swagger.class); configurer.accept(swagger); router.get(options.path + "/swagger.json", options.path + "/swagger.yml", req -> { boolean json = req.path().endsWith(".json"); if (json) { options.tryIt ? "</head>" : "<style> .try-out {display: none;}</style></head>"); router.get(options.path, req -> { String page = Optional.ofNullable(req.param("theme").value(options.theme)) .map(theme -> index.replace("<style>", "<link rel=\"stylesheet\" " router.get(options.redoc, () -> Results.ok(redoc).type(MediaType.html));