playframework

Why isn't my akka logging working inside of play

╄→гoц情女王★ 提交于 2020-01-04 01:21:06
问题 My logging is working fine from within my play code, but the akka code I have isn't logging to file/stdout. class EmailActor extends Actor with ActorLogging { import EmailActor._ log.info("email actor hatched..") ... } When I create this actor I don't see the logging entries in either the log file or stdout. I have the default application.conf from this activator template: https://github.com/playframework/play-scala/blob/master/conf/logback.xml Do I need to modify my logback file with some

Playframework 2.0 define function in View Template

萝らか妹 提交于 2020-01-03 17:29:18
问题 I am working on a project using PlayFramework 2.0. After reading a bit of scala I would like to embed some dynamic code in the View template. So, I did the following: @{ def getMystring(sequence:Int) = { if(patternForm != null && patternForm.get().windowTreatments != null && patternForm.get().windowTreatments.size() >= sequence + 1) sequence+"" else "" } } <input type = "text" value = @getMystring(1)></input> ... I was quite sure it was going to work but instead I got a "not found: value

unresolved dependency org.mongodb#bson#2.5, bad organisation in sbt

牧云@^-^@ 提交于 2020-01-03 17:23:30
问题 I'm trying to use "org.apache.mahout" % "mahout-integration" % "0.7" as a dependency inside my play2 based web application. [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: org.mongodb#bson;2.5: java.text.ParseException: inconsistent module descriptor file found in 'http://repo1.maven.org/maven2/org/mongodb/bson/2.5/bson-2.5.pom': bad organisation: expected='org.mongodb' found='org.bson';

Clean a Play framework build in IntelliJ

允我心安 提交于 2020-01-03 17:02:01
问题 I had a spelling mistake in the conf/routes file which caused incorrectly named classes to be generated by Play Framework. Rebuilding project and even running Invalidate Caches does not solve the problem in IntelliJ. The incorrect class files were re-generated when I manually run play clean from the command line. Is there an equivalent of Build Clean for Play Framework projects in IntelliJ? 回答1: You can either cd to the project and run play clean compile or create a run configuration to make

Play 2 - Scala - Forms Validators and radio buttons

倾然丶 夕夏残阳落幕 提交于 2020-01-03 16:37:01
问题 I'm need render a Form with validators for this model: Model: case class Service ( name: String, description: String, unitcost: Long, typo: Char, isactive: Char, modifiedby: String) Controller: import play.api.data.Form import play.api.data._ import play.api.data.format.Formats._ import play.api.data.Forms._ object Services extends Controller { .... .... private val servicesForm[Service] = Form( mapping( "name" -> nonEmptyText.verifying( "validation.name.duplicate", Service.findByName(_)

Play Framework 2.5.1 routing and dependency injection (for Java)

邮差的信 提交于 2020-01-03 13:40:33
问题 I have this in my "routes" file: POST /accounts/ controllers.AccountsController.createOneAccount And in my AccoutsController.java: package controllers; import com.google.inject.Inject; import play.Application; import play.mvc.Controller; import play.mvc.Result; import services.AccountService; import java.io.IOException; public class AccountsController extends Controller { @Inject private Application application; final String host = application.configuration().getString("db.default.host");

Play Framework 2.5.1 routing and dependency injection (for Java)

孤人 提交于 2020-01-03 13:40:16
问题 I have this in my "routes" file: POST /accounts/ controllers.AccountsController.createOneAccount And in my AccoutsController.java: package controllers; import com.google.inject.Inject; import play.Application; import play.mvc.Controller; import play.mvc.Result; import services.AccountService; import java.io.IOException; public class AccountsController extends Controller { @Inject private Application application; final String host = application.configuration().getString("db.default.host");

How to read a file in Play Framework 2.2.1?

两盒软妹~` 提交于 2020-01-03 11:02:53
问题 I have a static file that I want to read in one of my Play Framework models. The file contains some simple text in it. I can't find any examples or API that shows where the appropriate location is to store such a resource and second, how to access that resource. For whatever it is worth I'm using Play for Scala, but I don't think that's relevant here. 回答1: You can place any resource file in the folder /conf and load it (Programatically) as explained here: Custom configuration files - Play!

Play Cannot connect to (PostgreSQL) database [default]

六眼飞鱼酱① 提交于 2020-01-03 09:20:10
问题 I'm getting CreationException: Unable to create injector, see the following errors: 1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [default]] [...] 2) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [default]] Originally I had MySQL database used with Play Framework app which worked, but I wanted to change it to PostgreSQL and that's when problems started appearing. I've installed them both on my

Dynamic SQL Parameters with Anorm and Scala Play Framework

最后都变了- 提交于 2020-01-03 07:26:22
问题 Is it possible to dynamically create a list for anorm's "on" method? I have a form with optional inputs and currently I check each Option and create a list with the defined Options and am trying to pass this through to anorm. Currently I get this compilation error type mismatch; found : List[java.io.Serializable] required: (Any, anorm.ParameterValue[_]) I'm not sure how I would go about creating this list. Current code : val onList = List( 'school_id = input.school, if(input.rooms isDefined)