Created
March 13, 2013 13:42
-
-
Save blouerat/5152153 to your computer and use it in GitHub Desktop.
Displaying request headers in play2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
object Application extends Controller { | |
def index = Action { request => | |
Ok(views.html.index(request)) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(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