playframework-2.3

Keep play application running after putty terminal closed

£可爱£侵袭症+ 提交于 2019-12-07 02:37:30
How to keep play application running after putty terminal closed? After deploying play application in to server, I ssh'ed into server with putty terminal and ran the play application. However, once I close the putty terminal, play application no longer accepts http requests from client. To start the play application I used following command; ./{myplayapp}/bin/{executable} -Dhttp.port=8000 use screen to start your application. view existing screens with "screen -ls" and switch between them with "screen -r" http://wiki.ubuntuusers.de/screen I would recommend nohup : nohup ./script -Dhttp.port

Scheduling/delaying of jobs/tasks in Play framework 2.x app

不羁岁月 提交于 2019-12-07 02:36:57
问题 In a typical web application, there are some things that I would prefer to run as delayed jobs/tasks . They tend to have some or all of the following properties: Takes a long time (anywhere from multiple seconds to multiple minutes to multiple hours). Occupy some resource heavily (CPU, network, disk, external API limits, etc.) Result not immediately necessary. Can complete HTTP response without it. OK (and possibly even preferable) to delay until later. Can be (and possibly preferable to) run

Play Framework 2.3 and GAE - Google App Engine

不打扰是莪最后的温柔 提交于 2019-12-06 18:34:51
问题 Is there any sample application that uses Play Framework 2.3 and Google App Engine? 回答1: So far I have found this one: https://github.com/siderakis/playframework-appengine 回答2: Here is another tutorial with example: http://viralpatel.net/blogs/first-play-framework-gae-siena-application-tutorial-example/ 来源: https://stackoverflow.com/questions/24069774/play-framework-2-3-and-gae-google-app-engine

Catch DB down exception in playframework

穿精又带淫゛_ 提交于 2019-12-06 13:38:05
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 That Error you can handle in Global.java file in app folder put a file which Global.java in app folder like this Global.java file import play

Play Framework: Handling dynamic created files (images) in PRODUCTION mode

一个人想着一个人 提交于 2019-12-06 11:59:09
I'm trying to allow users to upload photos to the server and then view them (all users can view all photos) in production (NOT development). While in development mode everything is simple - I can upload the files to the public folder and then read then from there, in production mode I don't have access to the public folder anymore (as this approach is for static accesses and not dynamic). So, I have 2 issues: Upload: currently I can't understand how to save the uploaded photos to a specific folder, without using an absolute path to the location where I want the photos to be saved. Here is the

Play-Framework 2.4.x used with MongoDB and Java 8

假装没事ソ 提交于 2019-12-06 09:46:32
问题 I am creating a project using Play-Framework 2.4.x , MongoDB and Java 8 . But with Play-Framework there are no good mongo plugins for Java . Play-Framework mentions some plugin in there module section like Jongo, Mongo-Morphia but all are older and there updated are closed. I have an option to use Spring-Data-Mongo with Play-Framework, but my first priority is for plugin that have support and updates for Play-Framework and Java . Please recommend me, if there is are good plugins? 回答1: To use

right usage of slick filter

非 Y 不嫁゛ 提交于 2019-12-06 05:33:01
问题 I'm using slick to access database. I want to query like this: case class Coupon(couponId: Long, shopId: String) class Coupons(tag: Tag) extends Table[Coupon](tag, "coupons"){ def couponId = column[Long]("coupon_id") def shopId = column[String]("shop_id") override def * = (couponId, shopId) <> (Coupon.tupled, Coupon.unapply) } object Coupons extends TableQuery(new Coupons(_)){ def findCouponBy(couponId: Long, shopId: Option[String]) = { val s = DB.createSession() try { val q = for { coupon <-

Play framework 2.3.x Server Error Cannot register class

依然范特西╮ 提交于 2019-12-05 16:51:35
I recently uploaded Play application on server. Problem is that I can ran application through command activator run it compiles and runs fine. When I try to do activator clean stage it also compiles but after target/universal/stage/bin/name_of_myapp it throws an error like Oops, cannot start the server. Configuration error: Configuration error[Cannot register class [models.Movie] in Ebean server] at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) at play.api.Configuration.reportError(Configuration.scala:743) at play.Configuration.reportError(Configuration

Play 2.3 requireJs optimization and shim for multiple modules

依然范特西╮ 提交于 2019-12-05 12:40:59
This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation. requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js requireJsFolder := "js" Instead of requireJs use: RjsKeys.modules := Seq( WebJs.JS.Object("name" -> "mainAccount"), WebJs.JS.Object("name" -> "mainOrg"), WebJs.JS.Object("name" -> "mainPublic") ) Instead

static asset serving from absolute path in play framework 2.3.x

爱⌒轻易说出口 提交于 2019-12-05 07:27:45
问题 I need to serve image files from an absolute path that is not on the classpath. When I use Assets.at(path, file) , it only searches inside /assets . I have mapped the url onto a controller function like the following: public static Action<AnyContent> getImage(String imageId) { String path = PICTURE_UPLOAD_DIR; // here this path is absolute String file = imageId + ".png"; return Assets.at(path, file); } How can I make this work? NOTE: The reason to make images served using Assets is because of