Open BjoernAkAManf opened 9 years ago
Not sure about this one. @gitblit may know more about this...
For now you could move the @Path("/articles")
declaration to the method.
Jaxy does support @Path
-less method registration BUT it registers the method with a trailing forward-slash. If you accessed the above example at /articles/
it should work. Why does it do that? I can't remember - but it was deliberate. I'm inclined to think it was the wrong choice.
To change this behavior we would need to replace "/"
with ""
at this line:
https://github.com/ninjaframework/ninja/blob/develop/ninja-jaxy-routes/src/main/java/ninja/jaxy/JaxyRoutes.java#L116
And adjust the unit-test here: https://github.com/ninjaframework/ninja/blob/develop/ninja-jaxy-routes/src/test/java/controllers/ApplicationControllerTest.java#L298
Thanks for the explanation :)
No, it does not register any Route. Thats the whole issue. I did a test with and without / and both did not work. The output of the registered routes did reflect the same results @gitblit . I'm certain the class was not found and i think jaxy should consider the configured application package (but thats out of the scope for this issue anyway).
I'll have to review my project again and will provide further information as soon as my cloud is synced.
Just ran into something related to this. Looking at JaxyRoutes.registerMethods(), if no @Path is declared on the controller, controllerPaths comes back as an empty list. Therefore, no paths will be registered at all, even if they are declared at the method level.
Hello, im working on a plain and simple json api and thus i was not pleased to map each method in the controller by hand and i found jaxy quite handy. Thank you.
My articles controller will map the following (CRUD) operations: GET /api/articles -> List all articles GET /api/articles/:id -> List specific article POST /api/articles -> Creates new Article. PUT /api/articles/:id -> Updates specific article DELETE /api/articles/:id -> Deletes specific article
Based on #299 it should be possible to create Paths without @Path. This is crucial, as @Path("") looks nasty. [I would not mind having to add a trailing slash, as the jaxy tests show].
Using above Code the route will not be loaded.
I have played around with the jaxy module, but i didnt came up with something productive. For development purposes, i added a default value ("") to @Path so i can work until this issue is resolved.