Sometime it's necessary to extends a framework. Sometimes it's necessary to hook into the request/response lifecycle, for example for a parameter binding or to write a security module. How could this be done in the playframework 1.x?
相关问题
- PlayFramework: how to transform each element of a
- Could not import the newly generated play framewor
- Play Framework Unicode symbols in HTTP Header
- Putting output of 'git describe' in templa
- org.scala-sbt#sbt;${{sbt.version}}: not found on e
相关文章
- Testing request with CSRF Token in Play framework
- How to map an abstract collection with jpa?
- play2 framework my template is not seen. : package
- How does @Inject in Scala work
- play framework 2.0 - unexpected exception - Key No
- Error integration fingerprint U.are.U SDK with jav
- Custom bridge table in playframework ebean
- how to handle fileupload into a table in play fram
There are two ways to extend play 1.x. First you can write your own module. This is described in detail here. This is useful if you want provide a library such as iText or provide a special authentication mechanism.
The second way is to write a
PlayPlugin
. This is often done in modules but it's not a necessary condition. To write aPlayPlugin
requires two steps:PlayPlugin
and override some of its methods, for example calledmyPackage.MyPlugin
.play.plugins
and putting it into the classpath. The file must contain a line like1003:myPackage.MyPlugin
.The number defines the order in which the plugins are called. I recommend to use ids > 1000. If you want it to load before a framework plugin, look here (The ids are valid since 1.1.1).
That's it. To get a feeling of what you can do with a Plugin see the javadoc. You can hook into:
Unfortunately the javadoc documentation is minimal, but don't hesitate to look into the code of the playframework itself. It's easy to understand and gives you good ideas.