playframework-2.4

PlayRunHook does not work in multi module projects

给你一囗甜甜゛ 提交于 2020-01-03 02:24:35
问题 We need a base play framework projects which contains other play and scala projects as module. Those inner independent projects can have different javascript frameworks and build system like webpack, gulp, etc. So I tried the PlayRunHook from https://www.playframework.com/documentation/2.4.x/SBTCookbook . Single project hooking working as expected. But, unable to get it right on multi module project. Some code samples... Project Structure base/build.sbt name := """base""" version := "1.0

in play 2.4 logback configurations, where is ${application.home} defined?

心已入冬 提交于 2020-01-02 03:20:07
问题 The link here shows you how to configure your custom logger. https://www.playframework.com/documentation/2.4.x/SettingsLogger I was just wondering where is the ${applicaation.home} defined, as it seems to not have been defined in my production environment. 回答1: As indicated by @user316607, Play should define application.home by itself in the Logger.configure method. If you are seeing the value application.home_IS_UNDEFINED instead, and you're using compile-time dependency injection, you'll

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>

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) } }

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

Caching an action in a multi-language website using Play Framework's Cached API

安稳与你 提交于 2019-12-30 03:45:10
问题 In order to cache actions per label and language for a given number of seconds, I wrote the following helper method (where label, is the name I give to my action): def cacheResponseFor(label: String, duration: Int)(action: EssentialAction) = { Cached({r: RequestHeader => (label + getLanguage(r))}, duration){ action } } def getLanguage(request: RequestHeader): String = { request.cookies .get(helpers.SessionHelpers.LANGUAGE_SESSION) .map(_.value) .getOrElse(helpers.LanguageHelpers.FRENCH) } But

Intermittent Java - MySQL connection Exception | Play Java

孤街浪徒 提交于 2019-12-24 06:16:12
问题 I am using Play framework(JAVA) to connect to MYSQL. While interacting with the database, I am getting an intermittent(20% times) the error with exception: play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[NullPointerException: null]] at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:265) ~[play_2.10-2.4.2.jar:2.4.2] at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191) ~[play_2.10-2.4.2.jar:2.4.2]

Cannot use a method returning play.mvc.WebSocket as a Handler for requests in Play?

為{幸葍}努か 提交于 2019-12-23 04:59:30
问题 GET /status controllers.Application.handleWebSocketConnection() Here is the relevant source code. public WebSocket handleWebSocketConnection() { return WebSocket.withActor(new F.Function<ActorRef, Props>() { @Override public Props apply(ActorRef actorRef) throws Throwable { return UserActor.props(actorRef, ""); } }); } here is my build.sbt import play.routes.compiler.InjectedRoutesGenerator import play.sbt.PlayScala name := "hello" version := "1.0" lazy val `dashboard` = (project in file(".")

twitterBootstrap is not recognized in play framework 2.4?

▼魔方 西西 提交于 2019-12-23 02:26:14
问题 I'm using Play framework 2.4. I tried to use bootstrap as guided at https://www.playframework.com/documentation/2.0/ScalaFormHelpers. In my template, I used the import statement: @import helper.twitterBootstrap._ But I got a compilation error: object twitterBootstrap is not a member of package views.html.helper Am I missing something? 回答1: Maybe it has beed removed as mentioned here: https://www.playframework.com/documentation/2.3.3/Migration23 The in-built Twitter Bootstrap field constructor