Session

play.api.mvc.Session
See theSession companion object
case class Session(data: Map[String, String])

HTTP Session.

Session data are encoded into an HTTP cookie, and can only contain simple String values.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def +(kv: (String, String)): Session

Returns a new session with the given key-value pair added.

Returns a new session with the given key-value pair added.

For example:

session + ("username" -> "bob")

Value parameters

kv

the key-value pair to add

Attributes

Returns

the modified session

def ++(kvs: Iterable[(String, String)]): Session

Returns a new session with elements added from the given Iterable.

Returns a new session with elements added from the given Iterable.

Value parameters

kvs

an Iterable containing key-value pairs to add.

Attributes

def -(key: String): Session

Returns a new session with the given key removed.

Returns a new session with the given key removed.

For example:

session - "username"

Value parameters

key

the key to remove

Attributes

Returns

the modified session

def --(keys: Iterable[String]): Session

Returns a new session with the given keys removed.

Returns a new session with the given keys removed.

For example:

session -- Seq("username", "name")

Value parameters

keys

the keys to remove

Attributes

Returns

the modified session

def apply(key: String): String

Retrieves the session value associated with the given key.

Retrieves the session value associated with the given key.

Attributes

Throws
NoSuchElementException

if no value exists for the key.

def get(key: String): Option[String]

Optionally returns the session value associated with a key.

Optionally returns the session value associated with a key.

Attributes

Returns true if this session is empty.

Returns true if this session is empty.

Attributes

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Concrete fields

lazy val asJava: Session