If I don't use MyFormLoginHandler I get following error. Also, I am trying to authenticate from MongoDB. So I crated MyAuthProvider class. I am new to vertx. Let me know if I am missing something.
java.lang.IllegalStateException: Form body not parsed - do you forget to include a BodyHandler?
at io.vertx.ext.web.handler.impl.FormLoginHandlerImpl.handle(FormLoginHandlerImpl.java:86)
at io.vertx.ext.web.handler.impl.FormLoginHandlerImpl.handle(FormLoginHandlerImpl.java:35)
at io.vertx.ext.web.impl.RouteImpl.handleContext(RouteImpl.java:218)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:67)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:96)
at io.vertx.ext.web.handler.impl.UserSessionHandlerImpl.handle(UserSessionHandlerImpl.java:63)
at io.vertx.ext.web.handler.impl.UserSessionHandlerImpl.handle(UserSessionHandlerImpl.java:29)
at io.vertx.ext.web.impl.RouteImpl.handleContext(RouteImpl.java:218)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:67)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:96)
at io.vertx.ext.web.handler.impl.SessionHandlerImpl.handle(SessionHandlerImpl.java:100)
at io.vertx.ext.web.handler.impl.SessionHandlerImpl.handle(SessionHandlerImpl.java:30)
at io.vertx.ext.web.impl.RouteImpl.handleContext(RouteImpl.java:218)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:67)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:96)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.doEnd(BodyHandlerImpl.java:136)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.end(BodyHandlerImpl.java:122)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl.lambda$handle$105(BodyHandlerImpl.java:51)
at io.vertx.ext.web.handler.impl.BodyHandlerImpl$$Lambda$22/1158771039.handle(Unknown Source)
at io.vertx.core.http.impl.HttpServerRequestImpl.handleEnd(HttpServerRequestImpl.java:394)
at io.vertx.core.http.impl.ServerConnection.handleEnd(ServerConnection.java:288)
at io.vertx.core.http.impl.ServerConnection.processMessage(ServerConnection.java:403)
at io.vertx.core.http.impl.ServerConnection.handleMessage(ServerConnection.java:137)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.doMessageReceived(HttpServerImpl.java:516)
at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.doMessageReceived(HttpServerImpl.java:425)
at io.vertx.core.http.impl.VertxHttpHandler.lambda$channelRead$17(VertxHttpHandler.java:80)
at io.vertx.core.http.impl.VertxHttpHandler$$Lambda$16/705234202.run(Unknown Source)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:312)
at io.vertx.core.impl.ContextImpl$$Lambda$5/1393931310.run(Unknown Source)
at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:217)
at io.vertx.core.http.impl.VertxHttpHandler.channelRead(VertxHttpHandler.java:80)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:124)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
My Vertx Start is here. UserPersister is for storing user to Database. MyAuthProvider is for authenticating user.
public void start(Future<Void> startFuture) throws Exception {
Router router = Router.router(vertx);
// Serve the static pages
HttpServer server = vertx.createHttpServer();
router.route().handler(CorsHandler.create("*")
.allowedMethod(HttpMethod.GET)
.allowedMethod(HttpMethod.POST)
.allowedMethod(HttpMethod.OPTIONS)
.allowedHeader("X-PINGARUNER")
.allowedHeader("Content-Type"));
router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());