How to get/read a cookie in the Play Framework 2

Just a quick note today that if you need to read a cookie when using the Play Framework 2, one of these approaches should work:

// option 1
request.cookies.get("name")

// option 2
Http.Request.current().cookies.get("name")

You can find more information about these approaches at these links:

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.