当前位置: 首页>>代码示例>>Java>>正文


Java RoutingContext.put方法代码示例

本文整理汇总了Java中io.vertx.ext.web.RoutingContext.put方法的典型用法代码示例。如果您正苦于以下问题:Java RoutingContext.put方法的具体用法?Java RoutingContext.put怎么用?Java RoutingContext.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.web.RoutingContext的用法示例。


在下文中一共展示了RoutingContext.put方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext context) {
  HttpServerRequest request = context.request();
  // we need to keep state since we can be called again on reroute
  Boolean handled = context.get(BODY_HANDLED);
  if (handled == null || !handled) {
    BHandler handler = new BHandler(context);
    request.handler(handler);
    request.endHandler(v -> handler.end());
    context.put(BODY_HANDLED, true);
  } else {
    // on reroute we need to re-merge the form params if that was desired
    if (mergeFormAttributes && request.isExpectMultipart()) {
      request.params().addAll(request.formAttributes());
    }

    context.next();
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:20,代码来源:RestBodyHandler.java

示例2: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext rc) {
    // we define a hardcoded title for our application
    rc.put("name", "Vert.x Web");

    getUserProfiles(rc)
        .thenAccept(profiles -> rc.put("userProfiles", profiles))
        .thenAccept(v -> {
            // and now delegate to the engine to render it.
            engine.render(rc, "templates/index.hbs", res -> {
                if (res.succeeded()) {
                    rc.response().end(res.result());
                } else {
                    rc.fail(res.cause());
                }
            });
        });

}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:20,代码来源:IndexHandler.java

示例3: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext ctx) {

	String tid = ctx.request().getHeader(HttpHeaders.TID);
	if (StringUtils.isEmpty(tid)) {
		tid = TidGenerator.generate();
		ctx.put(HttpHeaders.TID, tid);
		ctx.request().headers().add(HttpHeaders.TID, tid);
		ctx.request().headers().add(HttpHeaders.GATEWAY_ORIGIN, ctx.request().absoluteURI());
		ctx.response().putHeader(HttpHeaders.TID, tid);
		if (log.isDebugEnabled()) {

			log.debug("Received request to [{}] with TID [{}]", ctx.request().uri(), tid);
		}
	}
	final String fTid = tid;
	ctx.response().bodyEndHandler(v -> {
		if (log.isDebugEnabled()) {

			log.debug("Finish request for TID [{}]", fTid);
		}
	});

	ctx.next();
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:26,代码来源:TidHandler.java

示例4: onRequest

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
private void onRequest(RoutingContext context) {
  if (transport == null) {
    transport = CseContext.getInstance().getTransportManager().findTransport(Const.RESTFUL);
  }
  HttpServletRequestEx requestEx = new VertxServerRequestToHttpServletRequest(context);
  HttpServletResponseEx responseEx = new VertxServerResponseToHttpServletResponse(context.response());

  RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
  context.put(RestConst.REST_PRODUCER_INVOCATION, restProducerInvocation);
  restProducerInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:12,代码来源:VertxRestDispatcher.java

示例5: loginHandler

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
private void loginHandler(RoutingContext context) {
  context.put("title", "Login");
  templateEngine.render(context, "templates", "/login.ftl", ar -> {
    if (ar.succeeded()) {
      context.response().putHeader("Content-Type", "text/html");
      context.response().end(ar.result());
    } else {
      context.fail(ar.cause());
    }
  });
}
 
开发者ID:vert-x3,项目名称:vertx-guide-for-java-devs,代码行数:12,代码来源:HttpServerVerticle.java

示例6: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(final RoutingContext c) {

    LOG.debug("Handling {} with from={} to={} protected={}", c, pathContext.getFrom(), pathContext.getTo(), pathContext.isProtected());
    c.put(PATH_CONTEXT, pathContext);
    c.next();
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:8,代码来源:ContextSettingHandler.java

示例7: buildArgs

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
/**
 * Template method
 *
 * @param context
 * @param event
 * @return
 */
protected Object[] buildArgs(final RoutingContext context,
                             final Event event) {
    Object[] cached = context.get(ID.PARAMS);
    if (null == cached) {
        cached = this.analyzer.in(context, event);
        context.put(ID.PARAMS, cached);
    }
    // Validation handler has been get the parameters.
    return cached;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:18,代码来源:BaseAim.java

示例8: pushContext

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
static void pushContext(RoutingContext context, Object object) {

		Assert.notNull(context, "Missing context!");
		Assert.notNull(object, "Can't push null into context!");

		context.put(ContextProviderFactory.getContextKey(object), object);
	}
 
开发者ID:zandero,项目名称:rest.vertx,代码行数:8,代码来源:RestRouter.java


注:本文中的io.vertx.ext.web.RoutingContext.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。