org.jooby.Router.get()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.jooby.Router.get方法的一些代码示例,展示了Router.get的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.get方法的具体详情如下:
包路径:org.jooby.Router
类名称:Router
方法名:get

Router.get介绍

[英]Append a route that matches the HTTP GET method:

get((req, rsp)  
 -> { 
rsp.send(something); 
});

[中]附加与HTTP GET方法匹配的路由:

get((req, rsp)  
 -> { 
rsp.send(something); 
});

代码示例

代码示例来源:origin: jooby-project/jooby

/**
 * 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);
}

代码示例来源:origin: jooby-project/jooby

/**
 * 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);
}

代码示例来源:origin: jooby-project/jooby

/**
 * 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);
}

代码示例来源:origin: jooby-project/jooby

@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)));
}

代码示例来源:origin: jooby-project/jooby

env.router().get(checkConfig.getString("path"), () -> response);

代码示例来源:origin: jooby-project/jooby

compiler.patterns().forEach(pattern -> routes.get(pattern, handler));

代码示例来源:origin: jooby-project/jooby

router.get("/login",
  new Pac4jLoginForm(Route.normalize(contextPath + callbackPath)))
  .name("pac4j(LoginForm)");

代码示例来源:origin: jooby-project/jooby

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

代码示例来源:origin: jooby-project/jooby

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);
 }));
}

代码示例来源:origin: jooby-project/jooby

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));

代码示例来源:origin: jooby-project/jooby

String rootpath = Route.normalize(conf.getString("application.path") + path);
routes.get(path, req -> Results.ok("<!DOCTYPE HTML>\n" +
  "<html>\n" +
  "<head>\n" +

代码示例来源:origin: org.jooby/jooby

/**
 * 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);
}

代码示例来源:origin: org.jooby/jooby

/**
 * 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);
}

代码示例来源:origin: org.jooby/jooby

/**
 * 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);
}

代码示例来源:origin: stackoverflow.com

router.get("/").handler((request) -> {
  vertx.eventBus().send("processMessage", null, (heavyDutyResponse) -> {
    if (heavyDutyResponse.succeeded()) {

代码示例来源:origin: stackoverflow.com

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);
}

代码示例来源:origin: org.jooby/jooby-consul

env.router().get(checkConfig.getString("path"), () -> response);

代码示例来源:origin: org.jooby/jooby-assets

compiler.patterns().forEach(pattern -> routes.get(pattern, handler));

代码示例来源:origin: org.jooby/jooby-apitool

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

代码示例来源:origin: org.jooby/jooby-apitool

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));

相关文章

微信公众号

最新文章

更多