Differences

This shows you the differences between two versions of the page.

Link to this comparison view

irc:1441490400 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +[05:50:42] <​voidDotClass>​ if vertx is used for node.js, is there any advantage, compared to using nodejs in its own implementation?​
 +
 +[10:42:45] *** ChanServ sets mode: +o purplefox
 +
 +[20:27:54] <​spriet2000>​ hello
 +
 +[20:28:22] <​spriet2000>​ i have some strange behaviour with the http server and sending files
 +
 +[20:28:32] <​spriet2000>​ vertx.createHttpServer(new HttpServerOptions().setPort(8080))
 +
 +[20:28:32] <​spriet2000> ​        ​.requestHandler(req -> {
 +
 +[20:28:32] <​spriet2000> ​            ​req.response().sendFile("/​not/​existing/​path",​ event -> {
 +
 +[20:28:32] <​spriet2000> ​                if (event.failed()) {
 +
 +[20:28:32] <​spriet2000> ​                    ​req.response().end("​failed"​);​
 +
 +[20:28:32] <​spriet2000> ​                } else {
 +
 +[20:28:33] <​spriet2000> ​                    ​req.response().end("​succeeded"​);​
 +
 +[20:28:33] <​spriet2000> ​                }
 +
 +[20:28:34] <​spriet2000> ​            });
 +
 +[20:28:34] <​spriet2000> ​        ​}).listen();​
 +
 +[20:29:07] <​spriet2000>​ when i execute the code doesnt write the failed text to the browser
 +
 +[20:29:52] <​spriet2000>​ is this a known issue?
 +
 +[20:30:19] <​spriet2000>​ vertx
 +
 +[20:30:56] <​spriet2000>​ or do i expect wrong behaviour?
 +
 +[20:33:36] <​spriet2000>​ can someone confirm this behaviour ?
 +
 +[20:46:36] <​Sticky>​ I am not familiar with the response, is simply writing a string into it sufficient to show the string in the browser, you dont need to form a propper page?
 +
 +[20:47:27] <​spriet2000>​ normally yes
 +
 +[20:48:38] <​Sticky>​ so have you debugged/​logged to confirm the sendFile handler is called?
 +
 +[20:48:44] <​spriet2000>​ urpd
 +
 +[20:48:47] <​spriet2000>​ yes
 +
 +[20:49:55] <​spriet2000>​ i have some breakpoint which are hit
 +
 +[20:50:01] <​Sticky>​ hmm, so "​succeeded"​ works if you give it a file that exists, but "​failed"​ fails
 +
 +[20:50:22] <​spriet2000>​ no succeeded sends the file
 +
 +[20:50:37] <​spriet2000>​ vertx.createHttpServer(new HttpServerOptions().setPort(8080))
 +
 +[20:50:37] <​spriet2000> ​        ​.requestHandler(req -> {
 +
 +[20:50:37] <​spriet2000> ​            ​req.response().sendFile("/​not/​existing/​path",​ event -> {
 +
 +[20:50:37] <​spriet2000> ​                if (event.failed()) {
 +
 +[20:50:37] <​spriet2000> ​                    ​req.response().end("​failed"​);​
 +
 +[20:50:38] <​spriet2000> ​                }
 +
 +[20:50:38] <​spriet2000> ​            });
 +
 +[20:50:39] <​spriet2000> ​        ​}).listen();​
 +
 +[20:58:39] <​spriet2000>​ well i posted the question
 +
 +[20:58:45] <​spriet2000>​ thanks for your help!
 +
 +[20:59:18] <​spriet2000>​ i am going to watch some telly
 +
 +[20:59:22] <​spriet2000>​ laterrrr
 +
 +[22:02:11] *** ChanServ sets mode: +o purplefox
 +
 +[22:32:36] <​BadApe>​ hi so i have a bit of code that looks like vertx.createHttpServer().requestHandler(router::​accept).listen(8080);​ before that i have a router for example router.put("/​products/:​productID"​).handler(this::​handleAddProduct);​
 +
 +[22:33:28] <​BadApe>​ now if i have a fairly large app i am going to have a ton of rest api's, now should i house each router in a class, get it to return the route and add it to a main router?