playframework-2.2

Overriding onRouteRequest with custom handler in Play! scala

情到浓时终转凉″ 提交于 2019-11-29 10:51:14
I'm using Play 2.2.1 and trying to override the onRouteRequest function in GlobalSettings. All the examples that I found online are for before Play 2.2.x and they don't seem to work in 2.2.x. Basically want to set some custom stuff in the response header for all responses. So far, I've tried the following, based on this: object Global extends GlobalSettings { override def onRouteRequest(request: RequestHeader): Option[Handler] = { super.onRouteRequest(request).map { handler => handler match { case a: Action[_] => CustomAction(a) case _ => handler } } } However this doesn't work as nothing

UNRESOLVED DEPENDENCIES installing Deadbolt on Play Framework 2.2.1

可紊 提交于 2019-11-29 10:03:40
I'd like to try Deadbolt. What are the steps to install it on the new Play Framework 2.2.1? What I found is resolvers and dependencies here . But where I have to put the resolvers? I don't want to use Build.scala (in Play 2.2 there's build.sbt ) And here is a line about plugin . Where it goes? In my project there isn't plugins.sbt and don't know if Play 2.2 prefers to put it elsewhere. EDIT : plugin.sbt resolvers ++= Seq( "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/", Resolver.url("Objectify Play Repository", url("http://schaloner.github.io/releases/"))(Resolver

How to run Play 2.2.x with Akka 2.3.x?

空扰寡人 提交于 2019-11-29 09:25:35
Is there any way to combine akka 2.3 and play 2.2? For now I'm getting AbstractMethodError while running such application. I need to have them both in one app because Akka 2.3 comes with very useful akka persistence module which is very reliable(in opposition to it's predecessor) and such reliability is really important in my case. I've tried compiling play 2.2.2 from sources and changing akka dependency there to 2.3 but i still get the same error: [ERROR] [04/01/2014 09:42:26.105] [play-akka.actor.default-dispatcher-6] [ActorSystem(play)] Uncaught error from thread [play-akka.actor.default

Why does sbt fail with NoClassDefFoundError: play/Play$ in Play 2.2.x projects after sbt compile in Play 2.3 project?

时光怂恿深爱的人放手 提交于 2019-11-29 06:07:28
Once I run 'sbt compile' on a 2.3 play project, I can't use 'sbt compile' to compile any Play 2.2.x projects anymore. This is the error when I run sbt command. [info] Loading project definition from /Users/macbookpro/playproject/project [error] java.lang.NoClassDefFoundError: play/Play$ [error] Use 'last' for the full log. Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? I just had this same issue. In my case I was using Play 2.4, but it's probably the same cause. I had run activator ui in my project directory accidentally. It created a project/play-fork-run.sbt file which is for

Expose Play Framework rest calls secured via securesocial to mobile app

你。 提交于 2019-11-28 17:07:23
I would like to expose my Play Framework REST calls to clients other than my play app. I would like a mobile app to call those secured rest calls. I asked a question on SO earlier in the year and got an answer but this only works for OAuth2 and I am only using OAuth1 My questions are: Is exposing my REST calls secured by Securesocial on my PlayFramework app to non web clients like Mobile apps a good idea? Is there a way to do this using Securesocial for OAuth1? Are there any examples apart from the one in the link from my last question? Latest changes in master-SNAPSHOT include a LoginApi

How get application version in play framework and build.sbt

你。 提交于 2019-11-28 10:16:58
I'm using play 2.2 with Scala, how can I get version from build.sbt? name := "project_name" version := "0.2-SNAPSHOT" play.Project.playScalaSettings or how can I pass there value from another object? I've added this to my build.sbt: import com.typesafe.config._ val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve() version := conf.getString("app.version") and in my application.conf: app.version="0.2-SNAPSHOT" biesior Take a look at the solution using the application.conf to keep version info (you must to modify it to fit 2.2 build file): Play Framework 2: Read the

Play Framework 2.2.1 - Compilation error: “method render in class index cannot be applied to given types;”

别等时光非礼了梦想. 提交于 2019-11-28 08:06:47
问题 I am new to Play Framework, and attempting to build a Todo-list from this manual. When I try to run the application I get the error: Compilation Error error: method render in class index cannot be applied to given types; My code is (the relevant parts): MainController.java : final static Form<Task> taskForm = Form.form(Task.class); public static Result tasks() { return ok( views.html.index.render(Task.all(), taskForm) ); } index.sacala.html : @(tasks: List[Models.Task], taskForm: Form[Models

How to use Http.Context.current() in a Promise in Play?

梦想的初衷 提交于 2019-11-28 04:44:49
问题 In Play Framework 2.2.2, I'd like to return a Promise. However I'm calling a function which needs access to the variables stored in Http.Context.current() (the current logged in user, the JPA connection...). Of course, since the Promise is executed in another thread, it doesn't have access to Http.Context.current() . Can I preserve it in the Promise, or should I restore it manually? Is there another pattern I should use? Example: public static Promise<Result> getAvailableServices() { return

UNRESOLVED DEPENDENCIES installing Deadbolt on Play Framework 2.2.1

£可爱£侵袭症+ 提交于 2019-11-28 03:25:12
问题 I'd like to try Deadbolt. What are the steps to install it on the new Play Framework 2.2.1? What I found is resolvers and dependencies here. But where I have to put the resolvers? I don't want to use Build.scala (in Play 2.2 there's build.sbt ) And here is a line about plugin . Where it goes? In my project there isn't plugins.sbt and don't know if Play 2.2 prefers to put it elsewhere. EDIT : plugin.sbt resolvers ++= Seq( "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",

IntelliJ IDEA Report Highlighting error when using routes in Controller

雨燕双飞 提交于 2019-11-28 03:12:19
I have a Scala Play project. I'm using Play 2.2.1. I downloaded Scala, Play 2 supported and SBT plugins. Everything is OK, but When I call route on Action in the Controller appear following error(Look screenshots): I'm using IntelliJ IDEA 12.1.6 Ultimate version. Scala version 2.10.2 Anybody know how to fix this problem? Thanks in advance! Edit When I generate my project to Intellij IDEA via "play idea" command in play console, and I opened project in IDEA project structure was such: Then I saw answer @millhouse and discussing on this githup( [Play 2.2] "play idea" creates not working source