playframework-2.1

How should I structure my nested reactivemongo calls in my play2 application?

这一生的挚爱 提交于 2019-12-04 22:13:24
I'm in the process of trying to combine some nested calls with reactivemongo in my play2 application. I get a list of objects returned from createObjects . I then loop over them, check if the object exist in the collection and if not insert them: def dostuff() = Action { implicit request => form.bindFromRequest.fold( errors => BadRequest(views.html.invite(errors)), form => { val objectsReadyForSave = createObjects(form.companyId, form.companyName, sms_pattern.findAllIn(form.phoneNumbers).toSet) Async { for(object <- objectsReadyForSave) { collection.find(BSONDocument("cId" -> object.get.cId,

BCrypt.checkpw() Invalid salt version exception

岁酱吖の 提交于 2019-12-04 10:11:48
问题 I'm trying to implement authentication using BCrypt, in my Play 2.1. Java application, but I'm getting Invalid salt version exception when I'm trying to authenticate the user. This is my stack trace play.api.Application$$anon$1: Execution exception[[IllegalArgumentException: Invalid salt version]] at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0] at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0] at play.core.server

How to debug play framework 2.1.0 scala tests in intellij

蓝咒 提交于 2019-12-04 08:02:47
i try to debug some tests with intellij. I have configurated the remote debug as explain in : How to make the debugging in playframework in IntelliJ Idea And can debug controllers and stuff. When I try to debug tests such as explain in: Is it possible to debug Play! tests from IntelliJ, with a moduled that is located in a sub-folder? But i recibe the next message: Action not found For request 'GET /@tests' These routes have been tried, in this order: 1GET/controllers.Application.index 2GET/assets/$file<.+>controllers.Assets.at(path:String = "/public", file:String) 3GET/api/crawl/task

Getting “how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name” compile error

你离开我真会死。 提交于 2019-12-04 07:42:07
My Play 2.1.1 project uses SBT 0.12.3, and when compiling it on my dev machine, everything's fine, I get no errors, and the app runs without any issues. When I try to compile it on an EC2 instance used for testing, I get the superlong error message below. The only possibly relevant difference between the two environments is that I have java 6 (1.6.0_45) on my dev machine, and java 7 (1.7.0_19) on EC2, but I can't currently change neither. Have you ever seen something like this? What can this be about? Thanks! [error] uncaught exception during compilation: java.lang.AssertionError [error]

Make Akka aware of Play's logback configuration

岁酱吖の 提交于 2019-12-04 04:26:55
How do I make Akka aware of Play's logback config (application-logger.xml)? In my case it is completely ignored: The log is ONLY printed to stdout. I expect it to be logged to the File-Appender defined in application-logger.xml It does not make a difference if I rename application-logger.xml to logback.xml. Actor-class: class Dispatcher extends Actor with ActorLogging { // prints to stdout ONLY: log.error("[akka-logger] dispatch started...") } conf/application.conf: play { akka { #log-config-on-start = on loggers = ["akka.event.slf4j.Slf4jLogger"] event-handlers = ["akka.event.slf4j

integration of sbt (play!) project with maven parent pom

雨燕双飞 提交于 2019-12-04 03:21:16
I have a maven project with multiple maven modules organized around parent pom. All these modules are packaged into JAR files which are dependencies of my Play! application built as a SBT project: MyProject -> pom.xml (parent) MavenModule1 -> pom.xml (child pom) MavenModule2 -> pom.xml (child pom) PlayApplication -> Build.scala (SBT project) Since all maven modules are child projects of parent module (MyProject), I can go to 'MyProject', execute mvn clean install and entire project, except PlayApplication will be built. The question is how can I modify parent pom/SBT build file to fire

Playframework 2.1 doesn't find javax.persistence and play.db

浪尽此生 提交于 2019-12-04 02:49:54
I have a problem with the Scala tutorial for creating an Entity with the play framework (Version 2.1). I'm trying to do: import java.util._ import javax.persistence._ import play.db.jpa._ But when I compile it tells me that javax.persistence dosen't exist and play.db neither. I suppose it's a problem of version because it seems to me that the actual yabe-tutorial is a bit old. Do you know any website who has good explanations and examples? Thanks for your help! As you use Scala you could take a look at Slick which seems to be the future db persistence framework for Play and abandon the one in

Play Json: Transforming a Reads[T] to Reads[Seq[T]] without implicits

£可爱£侵袭症+ 提交于 2019-12-04 00:54:10
I hava a Reads[T] . I would like to parse a Json object which is expected to be an array of T 's. Is there a simple way to obtain a Reads[Seq[T]] without defining my Reads[T] as implicit? Essentially, I am looking for a function that takes Reads[T] and returns Reads[Seq[T]] . I came across Reads.TraversableReads , and thought that I can pass the implicit reader it needs explicitly, but this function also wants a CanBuildForm[...] , which does not sound like fun. There is a method for this in the Reads companion object: Reads.seq . Its parameter is usually implicit, but you can always call it

Routes and subpackages in controllers

怎甘沉沦 提交于 2019-12-03 23:45:23
I'm using Play 2.1 and I'm having some odd problems. I have a subpackage messages in the controllers package with a class i18n.java . My routes file looks like this: GET \ controllers.messages.i18n.index() POST \ controllers.messages.i18n.process() I now have a form with the following action: @helper.form(action = routes.messages.i18n.process()) but this gives me an error: value messages is not a member of object controllers.routes I've used subpackages before in Play 2.0.4 and it worked fine like that, can anyone spot any errors in my configuration? The routes file doesn't complain that it

Add <script> to the <head> from scala template tags in Play Framework 2

家住魔仙堡 提交于 2019-12-03 17:04:36
I would like to add javascript to the <head> of my webpage from within tags. This is the moreScripts equivalent I'm using on my pages: main.scala.html @(title: String, scripts: Html = Html(""))(content: Html) <!DOCTYPE html> <html lang="nl"> <head> <title>@title</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> @scripts </head> <body> @content </body> </html> page.scala.html @scripts = { <script type="text/javascript"> $(document).ready(function() { alert(1); }); </script> } @main(