playframework-2.3

Can Play 2.3.x be used without Activator (and with maven)?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 11:51:26
问题 I have two related questions here. In Play 2.2.x, the distribution was bundled as a zip file, and available for download through the maven repository http://downloads.typesafe.com/play/2.2.x/play-2.2.x.zip. This meant that you could use a pom.xml and embed play into your app without needing to use sbt. Given 2.3.x has shifted to the activator model, is it still possible to use it with maven? And secondly, is it possible to use play 2.3.x without activator at all? (I know they have a sbt

How do I construct an Html object from a String variable in Java controller code within the play (2.3) framework

不羁岁月 提交于 2019-12-23 07:54:41
问题 I am just getting started working with the play framework, and I'm trying to understand the interaction between java application code, and the scala-based template framework (Note: I know absolutely nothing about Scala so far, beyond the fact that it's another language that compiles to bytecode on the JVM, and that your Scala and Java classes can interact). I have a test1.scala.html template that looks like this: @(title: String)(content: Html) <!DOCTYPE html> <html> <head> <title>@title<

How do I construct an Html object from a String variable in Java controller code within the play (2.3) framework

为君一笑 提交于 2019-12-23 07:53:04
问题 I am just getting started working with the play framework, and I'm trying to understand the interaction between java application code, and the scala-based template framework (Note: I know absolutely nothing about Scala so far, beyond the fact that it's another language that compiles to bytecode on the JVM, and that your Scala and Java classes can interact). I have a test1.scala.html template that looks like this: @(title: String)(content: Html) <!DOCTYPE html> <html> <head> <title>@title<

Catch DB down exception in playframework

[亡魂溺海] 提交于 2019-12-22 13:11:13
问题 I want to handle DB errors when DB are down or not exists,to catch this error in order to make application not crashing and make application keep running even the DB down, error raise when DB is down: [error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection to jdbc:sqlite:db/dev.db Sleeping for 1000ms and trying again. Attempts left: 4. Exception: null.Message:path to 'db/dev.db': '/home/madian/workspace/mom/src/mom/db' does not exist 回答1: That Error you can handle in Global.java

Play Framework 2.3.7: Static assets location not working in production

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:16:15
问题 I have seen a few questions on this but cant seem to get to the bottom of it. I have a Play Framework 2.3.7 (Activator 1.2.12) site, when I run it in dev mode everything works fine. When I start it in production mode I get the following errors: [app] $ start [info] Wrote C:\Users\App\git\website2.0\target\scala-2.10\app_2.10-1.0- SNAPSHOT.pom [info] Main Scala API documentation to C:\Users\App\git\website2.0\target\scala- 2.10\api... [info] Compiling 57 Scala sources and 58 Java sources to C:

Are there major scaling limits with play framework and jdbc blocking io calls

▼魔方 西西 提交于 2019-12-21 17:42:32
问题 I am using the playframework (2.4) for Java and connecting it to Postgres. The play framework is being used as a restful service and all it is doing is insert,updates,reads and deletes using JDBC. On this play page https://www.playframework.com/documentation/2.3.x/JavaAsync it states clearly that JDBC is blocking and that play has few threads. For the people who know about this, how limiting could this be and is there some way I can work around this? My specific app can have a few hundred

Dealing with failed futures

依然范特西╮ 提交于 2019-12-21 17:36:23
问题 In Play Framework 2.3, an action can produce a result from a successful future call like this: def index = Action.async { val futureInt = scala.concurrent.Future { intensiveComputation() } futureInt.map(i => Ok("Got result: " + i)) } But how can an action deal with a failed future call, i.e., a future that was completed by calling failure() instead of success() ? For instance, how could an action produce a InternalServerError result with the message returned in the future's failure's

How to change the default port 9000 in Play 2.3.x in build definition?

纵然是瞬间 提交于 2019-12-21 02:48:15
问题 With Play 2.2.x I could set the default port with build.sbt file i.e: Build.sbt play.Project.playScalaSettings play.Project.playDefaultPort := 9001 After 2.3.x upgrade play.Project.playDefaultPort does not exists any more. I do not want to type -Dhttp.port=9001 or run 9001 回答1: play.PlayImport.PlayKeys.playDefaultPort := 9001 https://github.com/playframework/playframework/blob/2.3.4/framework/src/sbt-plugin/src/main/scala/PlayImport.scala#L111 来源: https://stackoverflow.com/questions/26040275

Play JSON formatter for Map[Int,_]

China☆狼群 提交于 2019-12-20 12:36:38
问题 I am attempting to migrate a Rails/Mongodb application to Play 2.3 using play-reactivemongo and reactivemongo-extensions. In modeling my data I am running across a problem serializing and deserializing a Map[Int,Boolean]. When I try to define my formats via macro like so implicit val myCaseClass = Json.format[MyCaseClass] where MyCaseClass has a few string fields, a BSONObjectID field, and a Map[Int,Boolean] field the compiler complains with: No Json serializer found for type Map[Int,Boolean]

Why are integration tests in a Play/Scala project not executed when using “sbt it:test”?

自作多情 提交于 2019-12-20 10:36:49
问题 I have a Play Framework 2.3 project in which I'd like to separate unit tests and functional tests as follows: running sbt test should run unit tests and exclude integration tests running sbt it:test should run integration tests only The Scala documentation suggests using project/Build.scala , but I'd like to use combination of build.sbt and project/Build.scala , so my configuration looks like this (I have also tried putting all of configuration into Build.scala ): build.sbt ....