playframework

Play framework resource starvation after a few days

柔情痞子 提交于 2020-01-17 05:53:30
问题 I am experiencing an issue in Play 2.5.8 (Java) where database related service endpoints starts timing out after a few days even though the server CPU & memory usage seems fine. Endpoints that does not access the DB continue to work perfectly. The application runs on a t2.medium EC2 instance with a t2.medium MySQL RDS, both in the same availability zone. Most HTTP calls do lookups/updates to the database with around 8-12 requests per second, and there are also ±800 WebSocket connections

Strange enumerator/iteratee/Future behaviour when querying database

允我心安 提交于 2020-01-17 05:18:30
问题 I am new to Scala and Play! programming but have a reasonable amount of experience with webapps in Django, and plenty of general programming experience. I have been doing some exercises of my own to try to improve my understanding of Play! and this behaviour has me totally stumped. This is a follow-up question to the more general one here: Trying to understand Scala enumerator/iteratees I am trying to query a database, using Enumerators, Iteratees and Futures. When I code my controller thus:

play framework Logging ebean SQL statments

可紊 提交于 2020-01-17 03:06:53
问题 I'm using play 2.2.0 How cam I log ebean sql I tried db.default.logStatements=true logger.com.jolbox=DEBUG In config file but no luck. should I add any code to my models or create extra config files? what Is the configuration working for this version? 回答1: Hi you need to add logger.xml to your /conf/logger.xml . <configuration> <timestamp key="bySecond" datePattern="yyyy_MM_dd_HH_mm"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%-5level - %msg%n<

Custom view directories for Play Framework 2.x not working

為{幸葍}努か 提交于 2020-01-16 23:15:28
问题 I'm new to using Play Framework (2.2.x) and I am having a tough time figuring out how to render views not located in the \app\views directory. My project is organized such that each section (directory) of the app has it's own views, controllers, services, repositories... etc. It's a structure I'd like to keep. It looks something like this: \app\Game\Views \app\Game\Controllers \app\Game\Services \app\Game\Repositories \app\Players\Views \app\Players\Controllers \app\Common\Views \app\Common

Custom view directories for Play Framework 2.x not working

跟風遠走 提交于 2020-01-16 23:12:08
问题 I'm new to using Play Framework (2.2.x) and I am having a tough time figuring out how to render views not located in the \app\views directory. My project is organized such that each section (directory) of the app has it's own views, controllers, services, repositories... etc. It's a structure I'd like to keep. It looks something like this: \app\Game\Views \app\Game\Controllers \app\Game\Services \app\Game\Repositories \app\Players\Views \app\Players\Controllers \app\Common\Views \app\Common

How to get the raw request body in Play?

旧城冷巷雨未停 提交于 2020-01-16 08:24:12
问题 My play application has an endpoint for receiving webhooks from Stripe. In order to verify the webhooks, the request body needs to be compared against a signature and a signing key. This requires that I have access to the raw request body, as sent. However, it seems that Play alters the request body, and I can't get access to the raw contents. This causes the computed signature to change, and the verification fails. More info: https://stackoverflow.com/a/43894244/49153 Here's my code:

Play Framework: Call Controller/URL from within a Job

◇◆丶佛笑我妖孽 提交于 2020-01-16 07:41:25
问题 I have a job that runs on the hour. I would like to either call a Controller's Action method like this: public class MyJob extends Job { @Override public void doJob() throws Exception { MyController.someActionMethod(); } } or call a URL directly. Any ideas if this is possible from within a Job? If I call a Controller's action method directly, I get this: NullPointerException occured : null play.exceptions.JavaExecutionException at play.jobs.Job.call(Job.java:155) at java.util.concurrent

Call a Controller action method from within a Job

狂风中的少年 提交于 2020-01-16 04:49:25
问题 I am trying to call arbitrary controller actions, specified by a String , from a Job subclass. I have tried the accepted answer to this question, but found that it doesn't work for me... WS.url("http://www.yahoo.com/").get(); works, but WS.url("http://localhost/foo/bar").get() blocks and eventually times out after 60 seconds. I have also tried increasing the play.pool value in application.conf , as recommended in this answer, but it made no difference. Here is my code: application.conf: #

any playframework dynamic combobox pulldown menu examples out there?

时间秒杀一切 提交于 2020-01-16 04:14:29
问题 I am looking for an example that has some good patterns for doing a combo box....select html element in playframework and helping with the post as in seam it was nice that it auto translated it to the id of the entity I wanted....can I be storing the id with the item somehow in the pulldown so that when selected, I can give the id and label to the server? Any examples on this would be great!!!! or links to blogs that have some good pattern for this. thanks, Dean 回答1: Use the select tag. From

Mondrian OLAP connection management

孤街醉人 提交于 2020-01-15 12:32:20
问题 What is the recommended pattern for managing Mondrian database connections? I am using Mondrian as a library in a Scala/Play Framework web application. For example: var connection try { connection = DriverManager.getConnection(connection_string).unwrap(classOf[OlapConnection]) val result = connection.createStatement.executeOlapQuery(mdx) // ... use the result ... } finally { if (connection) connection.close } Is calling close in a finally block the right approach? How do I configure a