タイムアウトが 5 秒のときに別の URL にリダイレクトしたい。
私が持っているコード:
private void timeout(RoutingContext handler) {
vertx.setPeriodic(5000, new Handler<Long>() {
@Override
public void handle(Long aLong) {
System.out.println("Session expired : " + aLong);
handler.response().putHeader("location","/logout").setStatusCode(302).end();
}
});
}
私が得るエラーは次のとおりです。
java.lang.IllegalStateException: Response has already been written"