playframework

Play Framework 2.4.1: How to get configuration values just after configuration file has been loaded

百般思念 提交于 2020-01-13 10:17:07
问题 I need to read some configuration values just after the configuration file has been loaded but before the application actually starts. In Play 2.3.x I used to override GlobalSettings.onLoadConfig , which is deprecated in Play 2.4.x. The official documentation says one should use GuiceApplicationBuilder.loadConfig instead. Again, the documentation is a bit poor and I was unable to find more details or an example... so any help would be really appreciated. 回答1: 1. Before app starts If you need

Cannot register class in Ebean server (Play Framework 2 - Java)

我的未来我决定 提交于 2020-01-13 09:03:28
问题 I am getting the following error when running my Play Framework 2.2.x (Java) project: Configuration error Cannot register class [models.SomeClass] in Ebean server The error messages displayed in the browser points me to the line ebean.default="models.*" in my application.conf , and the console tells me that I have a java.lang.VerifyError: Bad type on operand stack in one of my methods. There is nothing special about the methods for which this happens, and it has happened for a handfull of

What are the differences between Play run and start?

别来无恙 提交于 2020-01-13 09:03:27
问题 I would like to understand the differences between running play start and play run, in the context of the problem below. My specific use case is rather complex, but I'll simplify it like this: On startup (as part of Global.scala), my Play application is making a direct method call to the entry point of a Java application X. As part of its initialization, X starts an embedded instance of Tomcat. At the end of X's initialization, it verifies that Tomcat is up and responding to requests. Now,

unresolved dependency for postgresql 9.2 jar in play framework

爱⌒轻易说出口 提交于 2020-01-13 08:19:31
问题 I am using postgresql 9.2 with play framework 2.1 I downloaded the driver here: http://jdbc.postgresql.org/download.html (JDBC4 Postgresql Driver, Version 9.2-1002) My project/Build.scala file is as follows: import sbt._ import Keys._ import play.Project._ object ApplicationBuild extends Build { val appName = "myApp" val appVersion = "0.1" val appDependencies = Seq( "postgresql" % "postgresql" % "9.2-1002.jdbc4") val main = play.Project(appName, appVersion, appDependencies) } I have placed

Play-Authenticate logout redirect

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 06:17:06
问题 I have integrated the Play-Authenticate module in my Play 2.0.4 project. There are two views to my project, a conventional web view and a mobile view. When the application logs out it just returns to the index page. In the routes table I see that the logout functionality points towards this: GET /logout com.feth.play.module.pa.controllers.Authenticate.logout Which looks like this in the module code: public static Result logout() { noCache(response()); return PlayAuthenticate.logout(session())

Playframework scala howto create temp variable

杀马特。学长 韩版系。学妹 提交于 2020-01-13 04:28:08
问题 Hi So I have a while loop: @for(i <- 0 until consoles.size) { ... Do something ... Add records to a column } But what I would like to add a variable and depending on what is going on add it to a different group. For example: @var column = 0; @for(i <- 0 until consoles.size) { @if(consoles[i].groupname != consoles[i - 1].groupname) { column = column + 1; } ... Do something ... Add records to a column } Is this possible. The only thing I have found is by passing in a variable and using that but

sbt-proguard with play 2.2.3

随声附和 提交于 2020-01-12 18:53:31
问题 We developed a web application with play 2.2.3 and want to obfuscate it. I am trying to use sbt-proguard plugin. I put the line below to PROJECT_FOLDER/project/plugins.sbt file addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") and put the lines below to PROJECT_FOLDER/build.sbt file proguardSettings ProguardKeys.options in Proguard ++= Seq("-dontnote", "-dontwarn", "-ignorewarnings") ProguardKeys.options in Proguard += ProguardOptions.keepMain("Application") inConfig(Proguard)

Play Framework — add new directories to classpath

五迷三道 提交于 2020-01-12 08:33:09
问题 I would like to be able to have a separate directory where jar files that represent plugins can be added to a Play 2.0 project. Jar files are normally kept under the /lib directory in Play. I'd like to separate my jars in a directory called /plugins This question was asked before, but the suggestion was to just use the /lib directory. Adding additional java files to playframework classpath Is there no way to do this without manually changing the 'eclipsified' files generated by Play? 回答1: I

Unsupported major.minor version 51.0 while running play framework

蹲街弑〆低调 提交于 2020-01-11 17:12:05
问题 I know there is version conflict. Just want someone to tell me how to resolve it. In previous stackoverflow post no one tells the solution. Versions: Ubuntu: 12.04.1 LTS java: 1.6.0_24 (OpenJDK) javac: 1.7.0_07 (OpenJDK) haider@haider-desktop:~/Documents/projects/java-projects/mytestapp$ play [info] Loading project definition from /home/haider/Documents/projects/java-projects/mytestapp/project [info] Set current project to mytestapp (in build file:/home/haider/Documents/projects/java-projects

What is Play framework web server

随声附和 提交于 2020-01-11 17:07:42
问题 Do anyone know which web server is used by play! framework? I'm planning to prototype a small intranet app using Play! and I am wondering whether I should use the default play web server or Apache or IIS as used internally. I don't predict several instances of the application running nor a need for load balancing. 回答1: The internal server is Netty. Unless you are forced to deploy a Play application in a servlet container, don't do it. Play performs better on Netty as it doesn't need to jump