aesteve / nubes

Annotation layer on top of Vert.x 3
Apache License 2.0
120 stars 35 forks source link

Could not get my controller method to execute #55

Closed asthanasid closed 8 years ago

asthanasid commented 8 years ago

Please find attached the controller class. I can see that the route is added in the vertx web router at /data/dashboard. But when i execute /data/dashboard url i get a not found message on browser. Cant find any thing in the documentation where i might be going wrong RestController.txt

aesteve commented 8 years ago

See : https://github.com/aesteve/nubes-issue-55

It should do what you want.

If you could submit a small runnable example when you have an issue it would help me alot.

Since I can :

For instance here the issue is probably not within the code you sent me :(

asthanasid commented 8 years ago

I have put the code which is not working for me here

https://github.com/asthanasid/nubes-issue-55

one difference is that i am using the convention if 'src-package' key instead of specifically mentioning controller packges, but i guess it should not make a difference.

aesteve commented 8 years ago

I'll have a look tomorrow, I don't have enough time this evening, sorry :(

The major difference is not the src-package but the way you instantiate the router. You're creating a router, passing it to nubes, but you're attaching it to the httpserver before nubes is bootstrapped.

Try moving : https://github.com/asthanasid/nubes-issue-55/blob/master/src/main/java/com/collatrice/frontend/FrontEnd.java#L52

-> line 66

And also, @Override the start(Future<Void> future) method (not the start()method) from AbstractVerticle since you're doing asynchronous stuff.

And after nubes is bootstrapped (bootstrapping is async) which means : line 66, call :

Not sure it's the cause of your issue, but it could be.

Hope this helps.

Note : you can also do it the other way around . Start by bootstrapping nubes, get the routernubes created for you, then attach your own routes (the sockjsHandler) to it.

Note² : once it works, you could also consider giving a try to Nubes' annotated eventbusbridge

asthanasid commented 8 years ago

It worked when initializing the http server after nubes bootstrap. It did not need the asynch version of start though! will need experiment to what difference does it make.

Thanks for the pointer :) I guess i am still getting my head wrapped around ways of Vertx. Its kind of weird that eventbus need to be/can be initialized after http server but routes cant be added