As I’ve said earlier, I think that the Play! framework is lovely. It makes it easy to develop and write code quickly. One of the ways that it enables this is through performing runtime byte code enhancement of the code. This makes execution of your code somewhat non-trivial when coming from a non-Play! context. Play! aims to meet all your needs, but use cases exist where it is important non-Play! code with Play! code, and have your non-Play! code call into Play!
Having said that this is non-trivial, it is reassuring to know that the process to do this is very straight forward.
- Create a subclass of play.Invoker.Invocation.
- Override the public void execute() method.
- Call the run() method of the invocation.
1 2 3 4 5 6 | Invoker.Invocation invocation = new Invoker.Invocation() { public void execute() { //do stuff with play here } }; invocation.run(); |
With this simple snippet of code, it is possible to have non-Play! code easily and cleanly call your Play! application code.





