Skip to content

Instantly share code, notes, and snippets.

@blouerat
Created March 13, 2013 13:42
Show Gist options
  • Save blouerat/5152153 to your computer and use it in GitHub Desktop.
Save blouerat/5152153 to your computer and use it in GitHub Desktop.
Displaying request headers in play2
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def index = Action { request =>
Ok(views.html.index(request))
}
}
@(request: play.api.mvc.Request[_])
@main("Play headers") {
<h3>Headers</h3>
<p>
<table>
<thead>
<tr><th>Header</th><th>Value</th></tr>
</thead>
<tbody>
@request.headers.keys.map { key =>
<tr>
<td>@key</td><td>@(request.headers.getAll(key).mkString("[", ", ", "]"))</td>
</tr>
}
</tbody>
</table>
</ul>
<p>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment