playframework

Play slick session connection timeout

試著忘記壹切 提交于 2020-01-05 09:05:40
问题 I'm having a problem with the session and connection handling in play with Slick 2.0.1 and play-slick 0.6.0.1 The error is [SQLException: Timed out waiting for a free available connection.] [...] Caused by: java.sql.SQLException: Timed out waiting for a free available connection. at com.jolbox.bonecp.DefaultConnectionStrategy.getConnectionInternal(DefaultConnectionStrategy.java:88) ~[bonecp.jar:na] [...] I have a play base controller trait for setting up the explicit session in one place

How to unit test servers in Play 2.6 now that Action singleton is deprecated

送分小仙女□ 提交于 2020-01-05 08:23:09
问题 At the time of writing, Play 2.6 is in release candidate state. The Action singleton has been deprecated, thus, all the information about testing here is deprecated: https://www.playframework.com/documentation/2.6.0-RC2/ScalaTestingWebServiceClients i.e. using the DSL for mock server routing like so: Server.withRouter() { case GET(p"/repositories") => Action { Results.Ok(Json.arr(Json.obj("full_name" -> "octocat/Hello-World"))) } } { implicit port => ... Causes deprecation warnings. Is there

play! application.conf content that's bit of confusing

微笑、不失礼 提交于 2020-01-05 08:09:48
问题 I am using play 1.2.3, in the application.conf, it has the following settings. What does each setting mean? It seems both are turned on, which one will take the priority? And also, if I remove the first setting (DEV mode), I don't get the PROD mode when run the app, am I missing anything? # Application mode # ~~~~~ # Set to dev to enable instant reloading and other development help. # Otherwise set to prod. application.mode=dev %prod.application.mode=prod 回答1: application.mode is run by

Compilation error when testing non blocking Redis client (Fyrie) on Play Framework 2.1

白昼怎懂夜的黑 提交于 2020-01-05 08:07:51
问题 when I try to compile the following code import play.api._ import play.api.mvc._ import scala.collection.mutable.StringBuilder import net.fyrie.redis.RedisClient import net.fyrie.redis.RedisClientConfig //import akka.dispatch._ //import akka.dispatch.Future object Application extends Controller { // val rd: RedisClient = new RedisClient("localhost", 6379, new RedisClientConfig(1, true, true, 50 to 100))(akka.actor.ActorSystem.create) val rd = RedisClient.apply("localhost", 6379, new

Escape semicolon route playframework 2.0.2

僤鯓⒐⒋嵵緔 提交于 2020-01-05 07:27:22
问题 I would like to do a redirect function with playframework. So far I have this in my routes GET /redirect com.test.redirect(redirecturl: String?="") and my controller : public static Result redirect(String redirecturl) { return redirect(redirectURL); } This is working well but I have a problem when I pass a url containing a semicolon ";" If I go to http:localhost:9000/redirect?redirecturl=http://www.google.com;testaftersemicolon It redirect me to google.com but in my log the redirecturl is

Escape semicolon route playframework 2.0.2

﹥>﹥吖頭↗ 提交于 2020-01-05 07:27:18
问题 I would like to do a redirect function with playframework. So far I have this in my routes GET /redirect com.test.redirect(redirecturl: String?="") and my controller : public static Result redirect(String redirecturl) { return redirect(redirectURL); } This is working well but I have a problem when I pass a url containing a semicolon ";" If I go to http:localhost:9000/redirect?redirecturl=http://www.google.com;testaftersemicolon It redirect me to google.com but in my log the redirecturl is

CSS in Play Framework 2.0.3

╄→尐↘猪︶ㄣ 提交于 2020-01-05 07:12:34
问题 I'm having some problems using CSS in Play Framework 2.0.3, and was wondering if anyone could spot the mistakes I am making. I have a view called siteview.scala.html, defined as: @(name: String, records: List[Record]) @import helper._ @main(name) { <html> <head> <link rel="stylesheet" type="text/css" href="@routes.Assets.at("stylesheets/main.css")"> </head> <h1>@name</h1> <ul> ... </ul> </html> } I have a CSS file defined as main.less in app/assets/stylesheets which looks like: h1 {color:

How do I get the template editor for Eclipse scala SKD?

点点圈 提交于 2020-01-05 06:59:41
问题 I am trying to get started developing with the Eclipse Scala SDK with the Play Framework. But when I try to select an editor with which to open my views (*.scala.html), there is no option that I can find that will (a) open the file correctly and (b) use syntax highlighting. Right now I am just using the text editor option. I read on this thread that the correct editor is the Template editor, but I cannot find that editor and I don't know how to get new editors. I have tried Preferences >

Getting play error in the Scala ant build

可紊 提交于 2020-01-05 05:39:08
问题 I am using play 1.2.7 and Following is my build script for scala files: <target name="init"> <property name="scala-library.jar" value="${env.SCALA_HOME}/lib/scala-library.jar" /> <path id="build.classpath"> <pathelement location="${lib}/anorm_2.10-2.3.1.jar"/> <pathelement location="${lib}/bootstrap-3.2.0.jar"/> <pathelement location="${lib}/jbcrypt-0.3m.jar"/> <pathelement location="${lib}/play-1.2.7.jar"/> <pathelement location="${lib}/play-ws_2.10-2.3.1.jar"/> <pathelement location="${lib}

Request-response life cycle in Play(Scala) 2.4.X

白昼怎懂夜的黑 提交于 2020-01-05 04:25:11
问题 Few days back, I faced issue where client was receiving response from play application after 20 seconds. I have new relic set on production server which keeps telling about RPM, average response time, CPU and memory usage, etc. As per new relic response time was not exceeding 500 milli-seconds, but I verified that client was receiving response after 20 seconds. To dig out more I added logs in that tells about time required to serve request in play application. I added logs Filter as per