playframework

How to kill a Play Framework process?

拜拜、爱过 提交于 2021-01-28 12:31:52
问题 I closed the terminal window by mistake and I don't know the PID of the running Play process. How to find it? Or, where is the RUNNING_PID file? I am using Play 2.4.6 and running in non-production mode ( activator run ). 回答1: When using dev mode ( activator run ), no RUNNING_PID file is generated. The process won't detach and will be killed when the terminal is closed. By default the RUNNING_PID file is written to ./target/universal/stage/RUNNING_PID (inside the project's root directory) when

Create table from slick table definition

冷暖自知 提交于 2021-01-28 05:24:33
问题 In PlaySlick sample there is file with sample data access object. https://github.com/playframework/play-slick/blob/master/samples/basic/app/dao/CatDAO.scala and table definition: private class CatsTable(tag: Tag) extends Table[Cat](tag, "CAT") { def name = column[String]("NAME", O.PrimaryKey) def color = column[String]("COLOR") def * = (name, color) <> (Cat.tupled, Cat.unapply) } Is it possible to generate a new table using this definition without using play evolutions? If not, why? 回答1:

Mongo Scala Play - java.lang.NoSuchMethodError: com.mongodb.ConnectionString.getApplicationName()Ljava/lang/String;]

可紊 提交于 2021-01-28 02:12:44
问题 I'm trying to do a basic CRUD on a scala play mongo prototype. The code works as a standalone main method - but when executed as a play application invoked through a controller, getting runtime exceptions [debug] Running task... Cancel: Null, check cycles: false, forcegc: true [info] play.api.Play - Application started (Dev) [error] application - ! @7b9n058gm - Internal server error, for (GET) [/mongoTestUserCollection] -> play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[

Play Framework: Run single selenium test on the command line (headless browser)

落爺英雄遲暮 提交于 2021-01-27 20:30:28
问题 I can run a single selenium test in play's browser UI, however, is it possible to execute a play selenium test on the command line? Obviously if I run play auto-test it will execute all my selenium tests (as well as my junit tests). Is there a way that I could tell Play to execute just a single selenium test on the command line to check whether it works using the headless browser? 回答1: I don't think it's possible to do so with the current play framework, but see how auto-test works on https:/

Play framework redirect HTTP to https

对着背影说爱祢 提交于 2021-01-27 05:42:18
问题 I used play framework version 2.2.3 and I run activator using following command for accessing site using https. ./activator run -Dhttp.port=disabled -Dhttps.port=9043 and I typed URL in browser as below https://localhost:9043/signin Then it work fine and it redirects to https. But problem is that when I changed my URL as below http://localhost:9043/signin then I want to redirect above URL to https, how should this handled in play framework? 回答1: as of play 2.6.x it's now supported by a

Execution Context and Dispatcher - Best practices, useful configurations and Documentation

半腔热情 提交于 2021-01-20 14:29:10
问题 Scala Execution Context and Dispatchers - Listing and comparison: Why ? There are a lot of questions around what/how/what is the best Execution Context to use to execute futures on in Scala and how to configure the dispatcher. Still I never was able to find a longer list with pros and cons and configuration examples. The best I could find was in the Akka Documentation: http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html and Play Documentation https://www.playframework.com

Play Framework 2.8.2 - No Json serializer found for type (subclass)

老子叫甜甜 提交于 2021-01-07 05:58:26
问题 I'm migrating some of my services from Play 2.7.x to the newest 2.8.2, together with scala 2.13.2 and sbt 1.3.12. I'm hitting an obstacle with the play-json though, and the Reads[A] I have the following setup: sealed trait Charge {} case class ChargeOne(one: Int) extends Charge case class ChargeTwo(two: Int) extends Charge object Charge { implicit val writes: Writes[Charge] = (charge: Charge) => {...} } We have some tests looking like so val chargeOne = ChargeOne(1) val json = Json.toJson

Play: How to remove the fields without value from JSON and create a new JSON with them

僤鯓⒐⒋嵵緔 提交于 2021-01-02 06:37:08
问题 Given the following JSON: { "field1": "value1", "field2": "", "field3": "value3", "field4": "" } How do I get two distinct JSONs, one containing the fields with value and another one containing the fields without value? Here below is how the final result should look like: { "field1": "value1", "field3": "value3" } { "field2": "", "field4": "" } 回答1: You have access to the JSON object's fields as a sequence of (String, JsValue) pairs and you can filter through them. You can filter out the ones

Error:Module 'name' production: java.lang.NullPointerException

不打扰是莪最后的温柔 提交于 2020-12-04 16:00:28
问题 I'm running my Java project in IntelliJ 14.1.1 and I'm using play framework. For some reason I can't compile any part of the code in IntelliJ (even though everything is working perfectly in the play environment). I get this error when trying to compile : Information:5/26/15, 19:26 - Compilation completed with 1 error and 0 warnings in 1s 165ms Error:Module 'doorman' production: java.lang.NullPointerException 'doorman' is the name of the project. Can anyone please help? 回答1: For me, it was the