Play Framework Notes - fcrimins/fcrimins.github.io GitHub Wiki
SecureSocial is an authentication module for Play Framework applications
- "In the success case, we’re sending a Redirect with a route to routes.Application.home here instead of rendering a view template. This pattern is called Redirect after POST, and is an excellent way to prevent duplicate form submissions."
- "A template is like a function, so it needs parameters, which must be declared at the top of the template file."
- Template Common Use Cases
views.html.[OptionalDir.]index
is a Scala class generated by Twirl from the views/[OptionalDir/]index.scala.html
template (note how views.html.index(testRelativity)
is called in Application.scala
- "keep data across multiple HTTP requests"
Database
- "A Controller is nothing more than an object that generates Action values. Controllers can be defined as classes to take advantage of Dependency Injection or as objects."
- "Note: Keep in mind that defining controllers as objects will not be supported in future versions of Play. Using classes is the recommended approach."
- Use the
Action
companion object to construct Action
instances, all of which return Result
s.
- TODO
def fredtest(name: String) = TODO
Ok(out)
is equivalent to:
Result(
header = ResponseHeader(200, Map.empty),
body = HttpEntity.Strict(ByteString(out), Some("text/plain"))
)