playframework-2.0

Keep session in subsequent Java calls to Play 2.0's fakeRequest

我怕爱的太早我们不能终老 提交于 2019-12-22 06:53:16
问题 I'm looking for a way to preserve the session when using Play 2.0's fakeRequest in my Java tests, but my attempts fail while invoking methods in the Scala-based JARs. Based on a pull request mentioned in the Scala question Add values to Session during testing (FakeRequest, FakeApplication), I figured the following might work in Java: public Session getSession(Result result) { play.api.mvc.Cookies scalaCookies = play.api.test.Helpers.cookies(result.getWrappedResult()); play.api.mvc.Cookie

Scala Play 2.3 InteliJ 14 *community edition - is it possible to run project without cmd line activator command

孤人 提交于 2019-12-22 06:47:52
问题 From http://blog.jetbrains.com/scala/2012/12/28/a-new-way-to-compile/ I understand that Intellij is using sbt to build - so thats 1x build At the moment I run a separate command line task to run my project - ./activator -jvm-debug 5000 -Dhttp.port=9000 So each code change gets compiled twice (once by InteliJ; once by activator) Is there a way to use the InteliJ build artifacts when I run, so the code is only compiled once? Is using the Terminal window in InteliJ any different from a normal

Accessing public static java method from scala

家住魔仙堡 提交于 2019-12-22 06:43:35
问题 I'm trying to use the Java facebook library here http://restfb.com/#publishing in a scala play2 app, but when trying to call the static with methods below, it gives me "Compliation Error [identifier expected but 'with' found.]". val fbClass = classOf[FacebookType] val param = Parameter.with("message", msg) val attachment = BinaryAttachment.with("cat.png", stream) val fbResp = facebookClient.publish("me/photos", fbClass, attachment, param) I see that there is an issue trying to invoke

Heroku POSTGRESQL - “Too many connections for role” error

寵の児 提交于 2019-12-22 06:08:25
问题 I've set up a connection from localhost to the Dev database on Heroku (as described in: Errors in evolutions on Heroku) and I am receving the following error after trying to apply evolutions a couple of times: SQLException: Unable to open a test connection to the given database. JDBC url = [URL], username = null. Terminating connection pool. Original Exception: org.postgresql.util.PSQLException: FATAL: too many connections for role "ntnkypawxazhwo" at org.postgresql.core.v3

ebean unidirectional @OneToOne relation with unique constraint

北城以北 提交于 2019-12-22 05:57:31
问题 I have a User class: @Entity public class User extends Model { @Id public Long id; public String email; public String name; public String password; } and a driver class @Entity public class Driver extends Model { @Id public Long id; @OneToOne (cascade = CascadeType.ALL) @Column(unique = true) public User user; } I want to make sure that the user_id is unique inside the Drivers table. But the code above does not enforce that. (I can create multiple drivers with the same user id). Ideally, I do

How to compress html with PlayFramework

走远了吗. 提交于 2019-12-22 05:45:26
问题 In order to improve the readability in the Scala forms I use indentation and new lines frequently. But when I verify the HTML when my play application is up and running I see a lot of white spaces and unnecessary line breaks. is there any why to compress this HTML out without "making my scala templates unreadable"? Thanks 回答1: As said in another answer there is nothing in the framework which permits to minify your HTML. To do so you will have to use a front-end HTTP server like Nginx. You

Java / Scala Future driven by a callback

那年仲夏 提交于 2019-12-22 05:42:06
问题 Short Version: How can I create a Promise<Result> which is completed on a trigger of a callback? Long Version: I am working on an application which deals with third-party SOAP services. A request from user delegates to multiple SOAP services simultaneously, aggregates the results and sends back to the user. The system needs to be scalable and should allow multiple concurrent users. As each user requests ends up triggering about 10 web service calls and each call blocking for about 1 second,

Java / Scala Future driven by a callback

只谈情不闲聊 提交于 2019-12-22 05:42:00
问题 Short Version: How can I create a Promise<Result> which is completed on a trigger of a callback? Long Version: I am working on an application which deals with third-party SOAP services. A request from user delegates to multiple SOAP services simultaneously, aggregates the results and sends back to the user. The system needs to be scalable and should allow multiple concurrent users. As each user requests ends up triggering about 10 web service calls and each call blocking for about 1 second,

Play Framework Routes not working

自古美人都是妖i 提交于 2019-12-22 05:19:44
问题 I am just trying to follow along with the ZenTasks tutorial (http://www.playframework.com/documentation/2.1.0/JavaGuide4) for the Play Framework. I can't seem to even get the Login page to work however. I am running this project with the play ~run command. When navigating to http://localhost:9000/login the error is Action not found For request 'GET /login' These routes have been tried, in this order: 1 GET/controllers.Application.index() 2 GET/assets/$file<.+>controllers.Assets.at(path:String

Unresolved dependency SBT org.scala-sbt#sbt_2.9.1;0.12.1: not found, Play examples

余生长醉 提交于 2019-12-22 04:52:09
问题 I am trying to run the samples in Play 2.0 framework but when I go to run "play" or "sbt". When I go to directory "/samples/scala/helloworld", I execute "sbt" and I obtain: [info] Loading project definition from C:\src\Play20\samples\scala\helloworld\project [warn] module not found: play#sbt-plugin;2.0 [warn] ==== typesafe-ivy-releases: tried [warn] http://repo.typesafe.com/typesafe/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.0/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn