本文整理汇总了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();
}
}
示例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();
}
示例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();
}
}
示例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());
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}