I want to invoke java Spark method get using reflection and it's not working. Apparently it executes well, but when I access the link it says 404 not found.
This is my code:
Route route = (request, response) ->
method.invoke(controller.newInstance(), request, response); //controller is the class which has the metod to execute
Method getMethod = Spark.class.getMethod("get", String.class, Route.class);
getMethod.invoke(null, url, route);
After the debug it seems to run well, but the route is not generated. Is there anyway to do that? Or am I doing something wrong?
Thank you!
EDIT
Now I managed to generate the route, but now it gives a 500 error. I think I might be not generating the route well. Can anyone help me?
Thanks!
Aucun commentaire:
Enregistrer un commentaire