Hi Darren,
I think there are at least 2 solutions.
1st solution is to create a class called NinjaImpl, implement Ninja
and put it into package ninja. This overwrites the original class via
classpath shadowing. This allows you to start right away and try your
ideas without thinking too much about the while Ninja stack. But
that's a hack.
(There are even more ways how to handle that. Ninja is only a binding
to NinjaImpl, so you might want use stuff like Guice overrides or use
your own implicit binding in your module.)
2nd solution is actually what we want. The clean solution is to create
a class that allows to handle such situations - including the option
to implement your own router. I think Play2 has a good blueprint with
its Global class.
I'd imagine something like that:
interface Global {
public void onError(Result result, Context context);
public void onRouteNotFound(Result result, Context context);
public void onRouteRequest(Result result, Context context);
}
+ and implementation GlobalImpl which is then used in NinjaImpl.
This allows you to cleanly handle errors (with correct response
content type, custom responses and more) and situations where no route
is found. And it allows you to implement your own routing mechanism
(or even replace Ninja's router).
Your issue is similar to
https://github.com/ninjaframework/ninja/issues/171 .
I might have some time end of June to look into the issue. But all
comments and PRs are really welcome :) It's something we need. Let me
know if you want to contribute :)
Cheers,
Raphael
> --
> You received this message because you are subscribed to the Google Groups
> "ninja-framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
ninja-framewo...@googlegroups.com.
> To post to this group, send email to
ninja-f...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ninja-framework/ddb819de-9293-4f7c-8723-8e82e3124730%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
inc:
http://ars-machina.raphaelbauer.com
tech:
http://ars-codia.raphaelbauer.com
web:
http://raphaelbauer.com