playframework-2.3

I can not import filters in playframework 2.3.0

那年仲夏 提交于 2019-12-08 16:22:42
问题 I use playframework 2.3.0, recently I want to add the CSRFFilter when I import csrf in global.scala: import play.filters.csrf._ I get an error for this: [error] G:\testprojects\app\Global.scala:7: object filters is not a member of package play [error] import play.filters.csrf._ My plugin.sbt is ... // The Play plugin addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.0") ... I use Build.scala instead of build.sbt lazy val root = Project("root", base = file(".")).enablePlugins(PlayScala)

Is there a way to conditionally apply annotations?

假装没事ソ 提交于 2019-12-08 15:27:18
问题 In my java-play application I have the annotation @RequiresAuthentication(clientName = "CasClient") inside my controller. I only want to authenticate users in my production environment. How can I apply annotations conditionally? If the way I'm approaching authentication is wrong, what is the conventional way of doing CAS authentication only on production in a java play application? 回答1: You could implement authenticators to authenticate users. you could you write your authentication logic in

Anorm 2.3 multi-value parameter: required anorm.NamedParameter

时光怂恿深爱的人放手 提交于 2019-12-08 05:48:31
问题 Using scala 2.11.1 on play framework 2.3. Because Anorm didn't support multi-value parameters in previous versions I used David's workaround. Anorm now supports multi-value parameters and I started removing the workaround and using Anorm multi-value parameters. The example [sic] mentioned: // With default formatting (", " as separator) SQL("SELECT * FROM Test WHERE cat IN ({categories})"). on('categories -> Seq("a", "b", "c") // -> SELECT * FROM Test WHERE cat IN ('a', 'b', 'c') Yet my code:

Keep play application running after putty terminal closed

谁说胖子不能爱 提交于 2019-12-08 04:16:01
问题 How to keep play application running after putty terminal closed? After deploying play application in to server, I ssh'ed into server with putty terminal and ran the play application. However, once I close the putty terminal, play application no longer accepts http requests from client. To start the play application I used following command; ./{myplayapp}/bin/{executable} -Dhttp.port=8000 回答1: use screen to start your application. view existing screens with "screen -ls" and switch between

Play Framework trouble importing scala template from different package

流过昼夜 提交于 2019-12-08 04:07:39
问题 Using Play 2.3.7, I have a set of bootstrap3 templates similar to this example project, and they are in a package app/views/bootstrap3/ . One of these bootstrap3 templates is a text field object in a file named text.scala.html . In a separate package, I have some other templates in which I want to use my custom text field. So, in package app/views/other/ let's say I have I have a file index.scala.html , how do I correctly import my Bootstrap3 templates? This is what I have in my code @import

Test HTTP response with PlayFramework/JUnit

随声附和 提交于 2019-12-08 03:36:26
问题 I've been looking for hours to find a way to test if a route is correct with play. I mean, for exemple Is the GET request to localhost:9000/test actually return 200 OK ? I was not able to find any working example. 回答1: I use Play's WS (Web Services) library to achieve this. For Example: package endpoints; import com.fasterxml.jackson.databind.JsonNode; import models.Meh; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import play.libs.Json; import play.libs

Play 2.3 got incompatible errors for DefaultReads

别说谁变了你拦得住时间么 提交于 2019-12-08 03:22:18
问题 I am trying to update play to 2.3 from 2.2, but I got several errors complaining about DefaultReads incompatible. [error] Could not access term time in package java, [error] because it (or its dependencies) are missing. Check your build definition for [error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) [error] A full rebuild may help if 'DefaultReads.class' was compiled against an incompatible version of java. [error] (jsObj \ "items"

How to publish webjar assets with publish/publishLocal in Play 2.3?

谁都会走 提交于 2019-12-07 21:35:48
问题 Since Play Framework 2.3 assets are packaged into one jar archive file. I would like to publish this jar automatically with the project, i.e. upon publish or publishLocal I want the assets jar to be published as well. How to achieve that? 回答1: After inspect tree dist I managed to find the task playPackageAssets that generates the assets file: [play-publish-webjar] $ inspect playPackageAssets [info] Task: java.io.File [info] Description: [info] [info] Provided by: [info] {file:/Users/jacek

Play framework 2.3.x Server Error Cannot register class

寵の児 提交于 2019-12-07 09:01:25
问题 I recently uploaded Play application on server. Problem is that I can ran application through command activator run it compiles and runs fine. When I try to do activator clean stage it also compiles but after target/universal/stage/bin/name_of_myapp it throws an error like Oops, cannot start the server. Configuration error: Configuration error[Cannot register class [models.Movie] in Ebean server] at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) at play

Play 2.3 requireJs optimization and shim for multiple modules

北慕城南 提交于 2019-12-07 07:22:26
问题 This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation. requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js requireJsFolder := "js" 回答1: Instead of requireJs use: RjsKeys.modules := Seq( WebJs.JS.Object("name