Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Failure Handler Issue
import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.ext.apex.Route;
import io.vertx.ext.apex.Router;
import io.vertx.ext.apex.handler.LoggerHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestServer extends AbstractVerticle {
private static final Logger logger = LoggerFactory.getLogger(TestServer.class);
public void start(final Future<Void> onStartup) {
Router testRouter1 = Router.router(vertx);
// Test case 1, I'd expect to get log lines but only the LoggerHandler gets hit
// 1) send something to /foo ie curl "http://localhost:8000/foo"
Route testRoute = testRouter1.route();
testRoute.failureHandler(routingContext -> {
logger.warn("Test case 1, no path found for {}", routingContext.request().uri());
vertx.createHttpServer(new HttpServerOptions().setHost("").setPort(8000))
.requestHandler(testRouter1::accept).listen(startupResult -> {"start - thread: {} starting to handle http requests on 8000", Thread.currentThread().getId());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.