playframework-1.x

Playframework route file: Separate Production routes from Dev routes

折月煮酒 提交于 2019-12-03 18:35:34
问题 Is there a way in Play to annotate routes to inform that a certain section/group routes is only available in dev or prod mode 回答1: Well, this is not documented, so I am not sure if this is intentionally possible or not, but I have found a way to make this work. Please note however, as this is an undocumented feature, may mean it is unintended, and therefore may break in future versions of play. You are able to achieve what you want using the following line in your routes file. %{ if (play

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

蹲街弑〆低调 提交于 2019-12-03 17:26:16
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 statement: var foo = 'I have a quote - ' - very dangerous'; What is the best place to escape this

Playframework [1.2.7] dependencies failing

眉间皱痕 提交于 2019-12-02 08:03:41
We're experiencing a problem with play frameworks dependency management which was working fine a couple of days ago. We haven't made any configuration changes or changes to the dependency file but are getting the following errors on both our build server and locally (both located on different networks and ISP's). :: problems summary :: :::: WARNINGS module not found: vsvr1#minifymod;1.0.9 ==== vsvr1: tried -- artifact vsvr1#minifymod;1.0.9!minifymod.jar: https://github.com/maklemenz/minifymod/raw/master/dist/minifymod-1.0.9.zip [NOT FOUND ] play#recaptcha;1.3!recaptcha.zip(jar) (139ms) ====

How to access a resource file using relative path in play framework project?

心已入冬 提交于 2019-12-01 14:18:35
问题 My play framework project uses resource files like CSV files that I have under resources directory which I created under play project root directly so it is at the same level as other directories like app, public etc. From within Java or Scala files how can I open such files using path that is relative to the project root? This path should also work when I create a war and deploy the application. 回答1: The VirtualFile class should do everything you need, especially the method 'fromRelativePath

JPA/Hibernate improve batch insert performance

折月煮酒 提交于 2019-11-30 19:23:34
问题 I have a data model that has a ONE TO MANY relationship between ONE entity and 11 other entities. These 12 entities together represent one data packet. The problem I am having is to do with the number of inserts that occur on the 'many' side of these relationships. Some of them can have as many as 100 individual values so to save one whole data packet in the database it requires up to 500 inserts. I am using MySQL 5.5 with InnoDB tables. Now, from testing the database I see that it can easily

Illegal pattern character 'Y' on Ubuntu

强颜欢笑 提交于 2019-11-29 09:24:12
I use this pattern SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); in windows and it works, but when try on Ubuntu 10.04 it show an exception play.exceptions.JavaExecutionException: Illegal pattern character 'Y' . I search for solution for this and found the year pattern must be change to lower-case: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); and it works. Can anyone can tell me the reason behind this why in Windows works but in Ubuntu didn't work if I use 'Y' instead of 'y'? Note: Play-1.2.3 JRE: Windows: java version "1.7.0_03" Java(TM) SE

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

隐身守侯 提交于 2019-11-29 03:44:52
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 example the Before-annotation. You annotate your action with the ByPass -Annotation, this Annotation

How can I specify a local jar file as a dependency in Play! Framework 1.x

别来无恙 提交于 2019-11-28 07:35:09
I have a jar file copied in the lib directory I'd like to run "play deps --sync" without this jar being deleted.. I've already looked at depency file documentation but couldn't figure out how to do it any idea? -- edit I've just found the answer: http://groups.google.com/group/play-framework/browse_thread/thread/b54e4e25ae49161b Gonna google around a bit more before asking here just like the answer in google groups said, I could achieve it with the following dependencies.yml file for library /jar/DateHelper-1.0.jar require: - play -> crud - provided -> DateHelper 1.0 repositories: - provided:

Play! framework uses a <lot> of statics

China☆狼群 提交于 2019-11-28 03:31:47
Waaah, the Play! framework has so many static methods. Where I go to school, we were told never ever to use any statics, yet Play! uses it like there's no tomorrow. Is that somehow okay? If so, why? We (7 people and I) are planning to use the Play! framework for a project involving a web app. We decided to do it with Play! because it looks quite fun to do, all of us already know Java and the assignment is pretty hard so we wanted to focus on the actual assignment rather than also learning how to program in a different language. We were always told, however, NEVER EVER to use 'static's in any

Illegal pattern character 'Y' on Ubuntu

爱⌒轻易说出口 提交于 2019-11-28 03:07:58
问题 I use this pattern SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); in windows and it works, but when try on Ubuntu 10.04 it show an exception play.exceptions.JavaExecutionException: Illegal pattern character 'Y' . I search for solution for this and found the year pattern must be change to lower-case: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); and it works. Can anyone can tell me the reason behind this why in Windows works but in Ubuntu didn't