From bf7ff0191e8b8d2dbc677dbc1b9f03ae495791fc Mon Sep 17 00:00:00 2001 From: TimFoerster Date: Mon, 19 Dec 2016 22:24:09 +0100 Subject: [PATCH] Get all elements of an attribute of the request To add and use multiple elements during a request. For example to add multiple Javascript files: https://gist.github.com/zv3/2dad7cb63813e82f8412 --- .../jp/t2v/lab/play2/stackc/StackableController.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/jp/t2v/lab/play2/stackc/StackableController.scala b/core/src/main/scala/jp/t2v/lab/play2/stackc/StackableController.scala index 236b863..8c72c07 100644 --- a/core/src/main/scala/jp/t2v/lab/play2/stackc/StackableController.scala +++ b/core/src/main/scala/jp/t2v/lab/play2/stackc/StackableController.scala @@ -73,6 +73,12 @@ class RequestWithAttributes[A](underlying: Request[A], attributes: TrieMap[Reque attributes.put(key, value) this } - + + def getAll[T](implicit classTag: ClassTag[T]) = { + attributes.filterKeys { + case p: T => true + case _ => false + } + } }