playframework-2.0

Adding Apache common dependency to Play Framework 2.0

情到浓时终转凉″ 提交于 2019-12-31 13:57:41
问题 i want to import org.apache.commons.io but i'm getting this error: [info] Compiling 1 Java source to /home/ghost/Bureau/app/play-2.0.1/waf/target/scala-2.9.1/classes... [error] /home/ghost/Bureau/app/play-2.0.1/waf/app/controllers/Application.java:9: error: package org.apache.commons.io does not exist [error] import org.apache.commons.io.*; [error] ^ [error] /home/ghost/Bureau/app/play-2.0.1/waf/app/controllers/Application.java:41: error: cannot find symbol [error] FileUtils.copyFile(file,

how to send form's element data in controller classin play /scala

空扰寡人 提交于 2019-12-31 03:26:09
问题 my routes.conf POST /getVerticalIndustry1/:guid controllers.Application.getVerticalIndustry(guid) my html javascript $('#partyId').on('change', function(event) { var selected_resource_id = $(this).val(); if(selected_resource_id==="Others"){ document.getElementById('pid').style.display='block'; } else document.getElementById('pid').style.display='none'; $.ajax( { type : 'POST', url : '@routes.Application.getVerticalIndustry()', data:{guid:$('#partyId').val()}, success : function(data) { alert(

how to inject dependencies to a service with MacWire (play framework)

谁说胖子不能爱 提交于 2019-12-31 03:15:11
问题 I have a service class, and the service have one method getSomethingFromApi , now , I want to have play Configuration instance so I can pull stuff from the application.conf, and a play WSClient so I can perform http calls. this is how I want my service to look: class MyApiService { def getSomethingFromApi(whichApi: String): Future[ApiRes] = { wsClient.url(configuration.getString(whichApi)).withHttpHeaders(("Content-Type", "application/json")).get.map { res => response.status match { case

Library 'scala-2.10.0-RC1 not used' thrown by IntelliJ integrating a Play 2 app

我只是一个虾纸丫 提交于 2019-12-31 03:12:20
问题 I've just generated a fresh Play! application, version 2.1-RC1. This one includes two Scala compiler/library couple: Scala 2.9.2 Scala 2.10.0-RC1 The whole well compiles within IntelliJ IDEA 12 but a warning occurs as the image shows it: It would seem so that another compiler is used instead 2.10.0-RC1. However, my Scala facet is configured as this: What might be the warning cause? I precise that I've got also a Scala variable environment (used for shell Scala commands) configured to point to

How to define a StopOnFirstFail dsl for play2's form?

隐身守侯 提交于 2019-12-31 02:55:38
问题 In this question: If a form field has multi validators, how to let play verify them one by one, not all?, Julien gave me a method named stopOnFirstFail to solve my problem: def stopOnFirstFail[T](constraints: Constraint[T]*) = Constraint { field: T => constraints.toList dropWhile (_(field) == Valid) match { case Nil => Valid case constraint :: _ => constraint(field) } } It's usage is: val loginForm = Form( "name" -> (text verifying stopOnFirstFail( nonEmpty, minLength(4) )) ) But I hope to

What's the difference between using play start and play run?

若如初见. 提交于 2019-12-30 18:34:20
问题 I am using play framework 2.0.4, I noticed that in the project folder, if I used play start , the server responses faster than server started via play run . However, user can not access static resources under public folder in the server started using start command, so I am wondering what's the start default configuration that changing the root directory or do I need to change routes which originally defined as: # Map static resources from the /public folder to the /assets URL path GET /assets

What's the difference between using play start and play run?

99封情书 提交于 2019-12-30 18:33:08
问题 I am using play framework 2.0.4, I noticed that in the project folder, if I used play start , the server responses faster than server started via play run . However, user can not access static resources under public folder in the server started using start command, so I am wondering what's the start default configuration that changing the root directory or do I need to change routes which originally defined as: # Map static resources from the /public folder to the /assets URL path GET /assets

Play2 How to manage the transaction from the service layer instead of action layer?

坚强是说给别人听的谎言 提交于 2019-12-30 13:59:26
问题 I am using Play2.1.1 Java with JPA2.0 with hibernate implementation. to control the transaction by code instead of using @transactional like below is the normal JPA code style, Is there any way to work like below at Play? or how to use JPA.withtranaction() to do? I tried it, no idea how to pass in the parameter, I am not familiar with functional code. thanks a lot. Please give me some sample code based on below. public void createActorB(final String email, final String psw) throws Throwable {

start shell script from “play dist” fails to locate logger.xml in JAR file

泪湿孤枕 提交于 2019-12-30 10:19:26
问题 I'm new to Play 2.1 and am trying to figure out the easiest way to deploy Play into our ops environment. The out-of-the-box Play 2.1 capability that holds the most promise is play dist Which builds a ZIP file that contains all the supporting JARs to run my app as well as some start shell script which launches the whole thing. Works like a champ. The problem is that my application requires more fine-grained logging than afforded by the out-of-the-box one-size-fits-all logs/application.log. On

How to change Play 2 Framework DB configuration at runtime?

走远了吗. 提交于 2019-12-30 09:35:12
问题 We are using Play 2.1.1 and its built-in JPA integration (JPA.em() etc). How can we dynamically change the db.pass property? Play.application().configuration() seems to be immutable as of Play 2.1. (or we're at least not aware of the mutators) If we are able to change db.pass, how can we reload the DB configuration so that JPA.em() returns an EntityManager using the new password? What we are trying to avoid is having to recreate the EntityManager using EntityManagerFactory. We want to