playframework

Play Framework @routes.Assets.at Compilation Error

邮差的信 提交于 2019-12-31 08:54:44
问题 I'm using Play 2.4.0 and I've been trying to follow the tutorial from the main page: https://playframework.com/ which is for Play 2.3 and after solving a couple of issues regarding changes in the Ebean ORM from version 2.3 to 2.4, I'm stuck with the following error: Compilation error value at is not a member of controllers.ReverseAssets My index.scala.html : @(message: String) @main("Welcome to Play") { <script type='text/javascript' src="@routes.Assets.at("javascripts/index.js")"></script>

Scala Play 2.3.0 with Anorm - Can't use Pattern Matching (IntelliJ cannot resolve symbol Row)

ぐ巨炮叔叔 提交于 2019-12-31 07:09:10
问题 I am developing an application with Scala (2.11) and Play Framework (2.3.0) on IntelliJ IDEA. I'm using Anorm to retrieve data from my database (MySQL with MariaDB). Here is my first test application (it works): package controllers import play.api.mvc._ import play.api.db._ import anorm._ case class Client(id: Int, nom: String, prenom: String) object Application extends Controller { def index = Action { var result: List[(Int, String)] = List() val sqlQuery = SQL( """ select idClient,

GuiceApplicationLoader configuration error

让人想犯罪 __ 提交于 2019-12-31 07:00:45
问题 So, I'm trying to implement compile time DI with something that looks like this: package modules class MyModule extends AbstractModule { def configure() { bind(classOf[MyT]).to(classOf[MyTImpl]) } } class MyApplicationLoader extends GuiceApplicationLoader { override protected def builder(context: ApplicationLoader.Context): GuiceApplicationBuilder = { initialBuilder .in(context.environment) .loadConfig(context.initialConfiguration) .overrides(overrides(context): _*) .load(new MyModule) } }

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

Play Framework [2.4.x] how to address public assets in a sub module's routing file

雨燕双飞 提交于 2019-12-30 20:31:51
问题 This previous question may serve as a baseline for what "submodules" mean for the purpose of the current discussion: Play Framework [2.4.x] Working with Sub Modules If you understand a Play submodule then given that context how does one enter the routing entry on the submodule to expose assets from a "public" folder? Whenever I attempt to make a basic entry (as follows) my entire root module fails to compile a single route and yet I get no "usable" error or other indicator as to what might

Play Framework [2.4.x] how to address public assets in a sub module's routing file

久未见 提交于 2019-12-30 20:31:31
问题 This previous question may serve as a baseline for what "submodules" mean for the purpose of the current discussion: Play Framework [2.4.x] Working with Sub Modules If you understand a Play submodule then given that context how does one enter the routing entry on the submodule to expose assets from a "public" folder? Whenever I attempt to make a basic entry (as follows) my entire root module fails to compile a single route and yet I get no "usable" error or other indicator as to what might

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

Play Framework test helpers need implicit `Materializer`

若如初见. 提交于 2019-12-30 10:35:02
问题 I'm using Play 2.6.x and the test helper for status(result) has the method: def status(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Int = status(of.run()) Running tests throws when the compiler can't find the implicit value: could not find implicit value for parameter mat: akka.stream.Materializer What is the Materializer -- I'm assuming it's part of Akka-HTTP And how can I provide one? 回答1: From akka streams docs: The Materializer is a factory for

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