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


Java RoutingContext.next方法代码示例

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


在下文中一共展示了RoutingContext.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ctx) {
	StringBuilder logStrBuilder = new StringBuilder();
	
	logStrBuilder.append(ctx.request().host()).append(" : ");
	logStrBuilder.append(ctx.request().method()).append(" ");
	logStrBuilder.append(ctx.request().uri()).append("\n");
	
	if(ctx.request().method() != HttpMethod.GET) {
		// Parameters show in Request URI
		logStrBuilder.append("Body - ").append(ctx.request().formAttributes());
	}
	
	Log.request(logStrBuilder.toString());
	
	ctx.next();
}
 
开发者ID:JoMingyu,项目名称:Server-Quickstart-Vert.x,代码行数:18,代码来源:LogHandlerImpl.java

示例3: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(final RoutingContext event) {
    if (event.failed()) {
        final Throwable ex = event.failure();
        if (ex instanceof WebException) {
            final WebException error = (WebException) ex;
            Answer.reply(event, Envelop.failure(error));
        } else {
            // Other exception found
            event.fail(ex);
        }
    } else {
        // Success, do not throw, continue to request
        event.next();
    }
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:17,代码来源:AuthenticateEndurer.java

示例4: executeRequest

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
static void executeRequest(final RoutingContext context,
                           final Map<String, List<Rule>> rulers,
                           final Depot depot,
                           final Object[] args,
                           final Validator verifier) {
    // Extract major object
    WebException error = verifyPureArguments(verifier, depot, args);
    // 1.Basic validation passed.
    if (null == error) {
        // 2. Body validation for jsonobject
        error = verifyBody(rulers, args);
        if (null == error) {
            context.next();
        } else {
            // Body validation of rulers failure
            replyError(context, error, depot.getEvent());
        }
    } else {
        // Hibernate validate failure
        replyError(context, error, depot.getEvent());
    }
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:23,代码来源:Flower.java

示例5: handlePreflight

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
private boolean handlePreflight(final RoutingContext ctx) {
    final HttpServerRequest request = ctx.request();
    // See: https://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0
    // Preflight requests should not be subject to security due to the reason UAs will remove the Authorization header
    if (request.method() == HttpMethod.OPTIONS) {
        // check if there is a access control request header
        final String accessControlRequestHeader = ctx.request().getHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
        if (accessControlRequestHeader != null) {
            // lookup for the Authorization header
            for (final String ctrlReq : accessControlRequestHeader.split(Strings.COMMA)) {
                if (ctrlReq.equalsIgnoreCase(HttpHeaders.AUTHORIZATION.toString())) {
                    // this request has auth in access control, so we can allow preflighs without authentication
                    ctx.next();
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:21,代码来源:AuthPhylum.java

示例6: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext ctx) {
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Cookie, Origin, X-Requested-With, Content-Type");
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "POST, PUT, PATCH, GET, DELETE, OPTIONS, HEAD, CONNECT");
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com/*");
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com/");
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com");
    ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
    if (secureManager.isBanned(ctx)) {
        ctx.response().setStatusCode(400);
        ctx.response().setStatusMessage("You are banned!");
        ctx.response().putHeader("Content-Type", "text/html; charset=utf-8");
        ctx.response().end("<h1>사이트에서 차단되었습니다.<br> 관리자에게 문의해 주세요 IP:"+ctx.request().remoteAddress().host()+"</h1>");
        ctx.response().close();
        return;
    }

    Log.l(" Method : " ,ctx.request().method()," Absolute URI : " , ctx.request().absoluteURI()," Params size : " , ctx.request().params().size());
    ctx.next();
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:21,代码来源:RequestSecurePreprocessor.java

示例7: handle

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

    HttpMethod method = ctx.request().method();

    switch (method) {

        case POST:
        case PUT:
        case DELETE:
        case PATCH:
            final Set<CSRFWhiteListHandler> blackList = whiteListHandlers.stream()
                    .filter(w -> w.match(ctx, config) && !w.whiteList(ctx, config))
                    .collect(Collectors.toSet());
            if (blackList.isEmpty())
                ctx.next();
            else
                super.handle(ctx);
            break;
        default:
            super.handle(ctx);
            break;
    }
}
 
开发者ID:GwtDomino,项目名称:domino,代码行数:25,代码来源:DominoCSRFHandler.java

示例8: 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

示例9: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext context) {
  AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(System.currentTimeMillis())
      .setRoutingContext(context);

  context.addBodyEndHandler(v -> log(accessLogParam));

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

示例10: fromSession

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
private void fromSession(RoutingContext routingContext) {
  String userName = WebServerUtils.getCurrentUserName(routingContext.session());
  if (userName == null) {
    throw new AccessDeniedException();
  }
  routingContext.next();
}
 
开发者ID:glytching,项目名称:dragoman,代码行数:8,代码来源:WebServerVerticle.java

示例11: 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

示例12: handle

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

    final String requestID = requestIDProvider.newRequestID(context);
    LOG.debug("requestID={}", requestID);
    context.next();
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:8,代码来源:RequestIDHandler.java

示例13: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext ctx) {
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Cookie, Origin, X-Requested-With, Content-Type");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "POST, PUT, PATCH, GET, DELETE, OPTIONS, HEAD, CONNECT");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com/*");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com/");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://dsm2015.cafe24.com");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
       ctx.next();
   }
 
开发者ID:JoMingyu,项目名称:Server-Quickstart-Vert.x,代码行数:11,代码来源:CORSHandlerImpl.java

示例14: handle

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
@Override
public void handle(RoutingContext ctx) {
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Cookie, Origin, X-Requested-With, Content-Type");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "POST, PUT, PATCH, GET, DELETE, OPTIONS, HEAD, CONNECT");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://52.79.134.200/*");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://52.79.134.200/");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "http://52.79.134.200");
       ctx.response().putHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
       ctx.next();
   }
 
开发者ID:JoMingyu,项目名称:Daejeon-People,代码行数:11,代码来源:CORSHandlerImpl.java

示例15: handlerFailure

import io.vertx.ext.web.RoutingContext; //导入方法依赖的package包/类
protected void handlerFailure(RoutingContext routingContext) {
    Object object = routingContext.get(CURRENT_SPAN);
    if (object instanceof Span) {
        final Span span = (Span)object;
        routingContext.addBodyEndHandler(event -> decorators.forEach(spanDecorator ->
                spanDecorator.onFailure(routingContext.failure(), routingContext.response(), span)));
    }

    routingContext.next();
}
 
开发者ID:opentracing-contrib,项目名称:java-vertx-web,代码行数:11,代码来源:TracingHandler.java


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