Skip to content

Commit

Permalink
Merge pull request #4530 from wsargent/fix-controller-doc
Browse files Browse the repository at this point in the history
Fix Controller scaladoc
  • Loading branch information
marcospereira committed May 22, 2015
2 parents c46ef1b + 3be3504 commit 969923c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions framework/src/play/src/main/scala/play/api/mvc/Controller.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait Controller extends Results with BodyParsers with HttpProtocol with Status
* For example:
* {{{
* def index(name:String) = Action { implicit request =>
* val username = session("username")
* val username = request2session("username")
* Ok("Hello " + username)
* }
* }}}
Expand All @@ -53,13 +53,24 @@ trait Controller extends Results with BodyParsers with HttpProtocol with Status
* For example:
* {{{
* def index(name:String) = Action { implicit request =>
* val message = flash("message")
* val message = request2flash("message")
* Ok("Got " + message)
* }
* }}}
*/
implicit def request2flash(implicit request: RequestHeader): Flash = request.flash

/**
* Retrieve the language implicitly from the request.
*
* For example:
* {{{
* def index(name:String) = Action { implicit request =>
* val lang: Lang = request2lang
* Ok("Got " + lang)
* }
* }}}
*/
implicit def request2lang(implicit request: RequestHeader): Lang = {
play.api.Play.maybeApplication.map(app => play.api.i18n.Messages.messagesApiCache(app).preferred(request).lang)
.getOrElse(request.acceptLanguages.headOption.getOrElse(play.api.i18n.Lang.defaultLang))
Expand Down

0 comments on commit 969923c

Please sign in to comment.