playframework-2.2

Play 2.2.2 / com.typesafe.play#play_2.10;2.2.2: not found on Heroku

谁都会走 提交于 2019-12-20 04:12:53
问题 All works well with Play 2.2.1. However, when upgrading to Play 2.2.2 and deploying to Heroku, process warns about: sbt.ResolveException: unresolved dependency: com.typesafe.play#play_2.10;2.2.2: not found unresolved dependency: com.typesafe.play#play-cache_2.10;2.2.2: not found unresolved dependency: com.typesafe.play#filters-helpers_2.10;2.2.2: not found unresolved dependency: com.typesafe.play#play-test_2.10;2.2.2: not found unresolved dependency: com.typesafe.play#play-docs_2.10;2.2.2:

How to not watch a file for changes in Play Framework

折月煮酒 提交于 2019-12-19 09:37:10
问题 On a Play Framework 2.2 project that is using sbt-buildinfo to create a BuildInfo.scala file when the project is compiled, how can build.sbt be configured so that Play Framework won't watch the BuildInfo.scala file for changes, and won't restart the server if that file changes? For instance, if a session is started with: $ sbt ~run and the server starts in development mode, and then in another terminal window another sbt session is started (to run another subproject, or just to run other sbt

No Json serializer found for type Seq[(String, String)]. Try to implement an implicit Writes or Format for this type

时光总嘲笑我的痴心妄想 提交于 2019-12-19 08:30:14
问题 I want to convert a Seq[(String, String)] into JSON with Scala play, but I face this error: No Json serializer found for type Seq[(String, String)]. Try to implement an implicit Writes or Format for this type. How can I fix this? 回答1: It depends on what you're trying to achieve. Say you have a Seq[(String, String)] like this: val tuples = Seq(("z", "x"), ("v", "b")) If you are trying to serialize it as following: { "z" : "x", "v" : "b" } Then just use Json.toJson(tuples.toMap) . If you'd like

Scala Play 2.2 application crashes after deploying in Heroku: target/start No such file or directory

偶尔善良 提交于 2019-12-19 05:46:45
问题 I've been fighting with this for hours and I can't figure out why after deploying my Scala Play 2.2 application in Heroku I get this stacktrace: 2013-09-30T01:05:09.413177+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=18174 $PLAY_OPTS` 2013-09-30T01:05:10.931893+00:00 app[web.1]: bash: target/start: No such file or directory 2013-09-30T01:05:12.382399+00:00 heroku[web.1]: Process exited with status 127 2013-09-30T01:05:12.414050+00:00 heroku[web.1]: State

Unable to test controller using Action.async

ぃ、小莉子 提交于 2019-12-19 05:17:36
问题 I'm trying to test controller, which is using new Action.async . Following documentation I have excluded part under controller I want to test to separate trait with type reference: trait UserController { this: Controller => def index() = Action { /* snip */ } def register() = Action.async(parse.json) { request => /* snip */ } } Documentation states that I'm supposed to test it as: object UsersControllerSpec extends PlaySpecification with Results { class TestController() extends Controller

Broadcasting messages in Play Framework WebSockets

◇◆丶佛笑我妖孽 提交于 2019-12-19 04:37:00
问题 I'm pushing messages in Play Framework WebSockets using Concurrent.unicast[JsValue] , and I want to optimize sending the same message to multiple users. Is it possible to broadcast message using somehow multiple Concurrent.Channel ? 回答1: Short answer Maintain separate channel for each user and have groups associated with users Long answer package controllers import akka.actor.Actor import play.api.libs.iteratee.Enumerator import play.api.libs.iteratee.Concurrent.Channel import play.api.libs

Broadcasting messages in Play Framework WebSockets

走远了吗. 提交于 2019-12-19 04:36:14
问题 I'm pushing messages in Play Framework WebSockets using Concurrent.unicast[JsValue] , and I want to optimize sending the same message to multiple users. Is it possible to broadcast message using somehow multiple Concurrent.Channel ? 回答1: Short answer Maintain separate channel for each user and have groups associated with users Long answer package controllers import akka.actor.Actor import play.api.libs.iteratee.Enumerator import play.api.libs.iteratee.Concurrent.Channel import play.api.libs

Defaults for missing properties in play 2 JSON formats

时光总嘲笑我的痴心妄想 提交于 2019-12-17 06:30:08
问题 I have an equivalent of the following model in play scala : case class Foo(id:Int,value:String) object Foo{ import play.api.libs.json.Json implicit val fooFormats = Json.format[Foo] } For the following Foo instance Foo(1, "foo") I would get the following JSON document: {"id":1, "value": "foo"} This JSON is persisted and read from a datastore. Now my requirements have changed and I need to add a property to Foo. The property has a default value : case class Foo(id:String,value:String, status

sbt runs IMain and play makes errors

风流意气都作罢 提交于 2019-12-13 22:06:43
问题 I've build a litte object, which can interpret scala code on the fly and catches a value out of it. object Interpreter { import scala.tools.nsc._ import scala.tools.nsc.interpreter._ class Dummy val settings = new Settings settings.usejavacp.value = false settings.embeddedDefaults[Dummy] // to make imain useable with sbt. val imain = new IMain(settings) def run(code: String, returnId: String) = { this.imain.beQuietDuring{ this.imain.interpret(code) } val ret = this.imain.valueOfTerm(returnId)

Getting a RuntimeException : Datasource user is null ? when updating User model in Play Framework 2.2.1

时光怂恿深爱的人放手 提交于 2019-12-13 11:11:47
问题 I am currently trying to enhance the To-Do List tutorial from Play framework's website. I've added a login form, (and of course a User class acting as a model), and it works perfectly well. I also made a small "dashboard" in which the logged user is able to change his password and his email address. But when I submit the form, I get a "Datasource user is null ?" error (RuntimeException). The whole problem came when I wanted to restrict the edition possibilities (I first used a whole User form