Note that there are some explanatory texts on larger screens.

plurals
  1. POUsage of javascriptRouter in Play 2.0.2
    primarykey
    data
    text
    <p>I have an app which I am trying to upgrade to Play 2.0.2 (from Play 2.0.1). I have this piece of code which worked on Play 2.0.1 but doesn't anymore</p> <pre><code>@javascriptRouter("jsRoutes")( routes.javascript.Contacts.invite, routes.javascript.Contacts.remove ) </code></pre> <p>The compiler complains:</p> <pre><code>[error] /myprojectdir/target/scala-2.9.1/src_managed/main/views/html/Contacts/list.template.scala:75: Cannot find any HTTP Request Header here [error] """),_display_(Seq[Any](/*41.2*/javascriptRouter("jsRoutes")( [error] ^ [error] one error found [error] {file:/myprojectdir/}projectname/compile:compile: Compilation failed [error] Total time: 9 s, completed 11.07.2012 11:38:51 </code></pre> <p>This has been noticed on the mailinglist, and one user has <a href="https://groups.google.com/d/msg/play-framework/Z97GQ2VnR5M/XLzkcRykTrUJ" rel="nofollow">fixed the problem</a>. I get that there is some implicit parameter that needs to be passed, but I have no idea how to do this. I tried adding(?) this to my template according to the mentioned <a href="https://github.com/playframework/Play20/blob/db5d40b81f3599ebb6f31e63fbba03d480c0d62c/samples/workinprogress/akka-chat/app/views/room.scala.html" rel="nofollow">example file</a>, basically changing my templates first line from</p> <pre><code>@(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm]) </code></pre> <p>to </p> <pre><code>@(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm])(implicit request: RequestHeader) </code></pre> <p>But this seems to change the type signature of the template(?), which is not quite what I would like to happen.</p> <p>Any suggestions? Everything with (?) is stuff I am not entirely sure of. I've worked with some implicit conversions in Scala before, but I am not sure what Play expects of me here and if I am making a scala or play mistake.</p> <p>EDIT: There is a corresponding ticket in <a href="https://play.lighthouseapp.com/projects/82401/tickets/581-21-snapshot-jsroutes-missing-implicit-http-request-headers" rel="nofollow">the bugtracker</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload