说我有这个中间件类:
public class Middleware implements Handler<RoutingContext> {
public void handle(RoutingContext ctx) {
ctx.set("foo", "bar"); // ctx.set is an imaginary method
ctx.next();
}
}
ctx.set()方法已完成-在3.6.2版本中不存在。 那么我们如何在请求的上下文中设置任意信息?
答案 0 :(得分:1)
有一个put
方法:
public class Middleware implements Handler<RoutingContext> {
public void handle(RoutingContext ctx) {
ctx.put("foo", "bar");
ctx.next();
}
}