playframework-1.x

JPA Query Select many-to-one Query with a count

点点圈 提交于 2021-02-07 18:31:25
问题 So I'm trying to write a JPA query based on the classes below (dumbed down a bit) that will produce the following: So I have two objects: Thing and Person. A Person can hold a reference to a single Thing. Here are simplified version of the Classes: public class Thing { @Id public Long id; public String name; public String description; } public class Person { @Id public Long id; public String firstname; public String lastname; @ManyToOne public Thing thing; } I'm trying to write a JPA query

proper way of writing FunctionalTest in playframework

徘徊边缘 提交于 2020-01-24 14:40:07
问题 While writing FunctionalTest for a webapp based on play1.2.4,I was a little confused as to how to code it properly.The confusion is regarding the transaction boundary involved.I read somewhere that each test has its own transaction. In my app,a User can login and add some items to the cart.Then he can give an Address sothat the items can be sent to him. I created private helper methods like below private Cart buyItemsAsCustomer(String email,String pass) { User user = User.find("byEmail",

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: #

How can I influence the redirect behavior in a play-controller?

核能气质少年 提交于 2020-01-10 01:06:11
问题 In play you always follow the Redirect-After-Post-Pattern if you call from a public-method of a controller. This is in most cases a good behavior, but sometime it could be nasty. So I tried to find out how it works in play 1.1!: The basic is some byte-code-enhancement, which is done in play.classloading.enhancers.ControllersEnhancer . There you can find that there still exists some exceptions of the default behavior: If your method is annotated by an annotation from the package play.mvc , for

How can I influence the redirect behavior in a play-controller?

巧了我就是萌 提交于 2020-01-10 01:05:53
问题 In play you always follow the Redirect-After-Post-Pattern if you call from a public-method of a controller. This is in most cases a good behavior, but sometime it could be nasty. So I tried to find out how it works in play 1.1!: The basic is some byte-code-enhancement, which is done in play.classloading.enhancers.ControllersEnhancer . There you can find that there still exists some exceptions of the default behavior: If your method is annotated by an annotation from the package play.mvc , for

Where is the proper place to escape quotes in Play Framework?

余生颓废 提交于 2020-01-01 07:02:33
问题 I have the following flow: A user is presented with a form. He fills in the form fields, and submits to the controller, which persists this to the DB On another page, the Controller gets this record from the DB, and passes it to the view The view captures it as a javascript variable: var foo = '${user.bar}'; Now, if the user enters this string in the form: I have a quote - ' - very dangerous then the quote is passed through all the way to the DB and back, and results in a corrupt javascript

How do I obtain the 'reason' for a forbidden()?

六眼飞鱼酱① 提交于 2019-12-25 05:17:13
问题 I'm designing my 403 page and I can't seem to obtain the 'reason' string which I am populating on various forbidden pages to give a more relative response to the issue at hand. If I type ${response.reason} in the template, the whole page gets replaced with just the text of the response. 回答1: In the code it seems that you can get this value in your template by doing ${result.getMessage()} result is your Forbidden object that inherits from RuntimeException and the description you provide is

How make an object that's shared across the entire application in play framework (1.x)?

别来无恙 提交于 2019-12-24 05:47:13
问题 I want to make one instance of an object across the entire Play Application. I don't think static will work because Play uses many classloaders to load the same class many times (I confirmed this with a heap analysis). Is there something like InitialContext resources to store and retrieve an object instance across the entire app? 来源: https://stackoverflow.com/questions/37909439/how-make-an-object-thats-shared-across-the-entire-application-in-play-framework

Play Framework becoming unresponsive? (Possibly memory issues)

不羁的心 提交于 2019-12-24 02:14:41
问题 We got a Play 1.2.5 application and we've had some problems with the application becoming unresponsive. After setting proper memory settings for the application the problem hasn't reoccurred (a couple of days ATM) but I'd like to get idea of the actual reason and if there's some way to see it in the logs. In our setup, we got Play 1.2.5 application running on AWS (Ubuntu 12.04) MySQL RDS database Apache server working as a proxy (handling SSL etc). This has happened for various calls but I

HttpURLConnection redirects my POST request into a GET

↘锁芯ラ 提交于 2019-12-23 12:10:46
问题 I'm sending a HttpURLConnection with setInstanceFollowRedirects(true) and POST , get a redirect response that looks like this: HTTP/1.1 302 Found Server: nginx Date: Wed, 09 Jan 2013 20:47:56 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Status: 302 Found Status: 301 Moved Permanently Location: http://foo.bar/... And the next request that the JVM sends is a GET request (to the correct, redirected URL). It also seems to drop one of the HTTP