playframework-2.1

PlayFramework 2.1, submodules and Eclipse having errors about invalid package name

不想你离开。 提交于 2019-12-25 04:17:06
问题 Using PlayFramework 2.1 and submodules, I have an error with all my controllers in Eclipse : "The declared package "controllers.website" does not match the expected package "controllers" Of course, because in my module, I added controllers in modules/{submodule_name}/app/controllers/ , eg: modules/website/app/controllers/ But as defined in the documentation of Play, controllers must have the package name "controllers.{submodule_name}" ("controllers.website"). And this results in an error in

How do we call “Caching in Template” for Play 2.1?

大兔子大兔子 提交于 2019-12-24 10:47:17
问题 We are trying to follow the "Caching in templates" example listed in http://www.playframework.com/documentation/2.1.1/JavaCache and the compiler throws us an " not enough arguments for method getOrElse " exception message. Our code in the template: @play.cache.Cache.getOrElse("cached-content", 3600){ test } So we decided to dig the API and apparently we still short of java.util.concurrent.Callable parameter. Does anyone know what should we pass in for that parameter? Thanks Play 2.1.1 Javadoc

How to Clear All Cache in Play Framework 2.1

倖福魔咒の 提交于 2019-12-23 16:31:05
问题 So I'm using Play's built in cache API as seen here: http://www.playframework.com/documentation/2.1.x/JavaCache In my code I've already set the cache to expire every 10 minutes. I am also using the session cache style. So my main question is, since it's gonna be really hard to keep track of all cache, how do I clear all of the cache? I know that using Play's default cache is minimal but it's working perfectly for me at this point. I just want the ability to clear the cache once in awhile just

play framework pretty print date

青春壹個敷衍的年華 提交于 2019-12-23 15:29:24
问题 I've been googling for a while but I just can't seem to figure out how to pretty print a java date in a template my application.conf contains date.format="yyyy-MM-dd hh:mm:ss" and this is what I'm trying in my template ${(event.date).format('dd MMMM yyyy')} The event member looks like @Required public Date date; Any help would be appreciated, cheers! 回答1: You are using Play 1 formatting, which doesn't work in the Play 2 scala templates. You need to use the @ symbol in Play 2. Try @event.date

Mailer plugin throws NullPointerException

▼魔方 西西 提交于 2019-12-23 14:02:34
问题 When I try to use the Mailer Plugin (version 2.1-SNAPSHOT) as explained here everything seems fine, meaning all dependencies are resolved and there are no compilation errors. However when this code is executed MailerAPI mail = play.Play.application().plugin(MailerPlugin.class).email(); I get a NullPointerException on this line. The exception is generated because the call to plugin returns null . Any hints on what is going on here? I'm using Play 2.1-RC2 and the app is written in Java. 回答1: As

EntityNotFoundException: Bean has been deleted - lazy loading failed

空扰寡人 提交于 2019-12-23 13:13:43
问题 I'm making my first steps with the Play! Framework (v2.1-rc1) with Java and now I've faced my first problem with ebean. I have a navigation entity with a ManyToOne relationship to itself. As soon as I try to access the title field in a parentNavigation, I get the following error: [EntityNotFoundException: Bean has been deleted - lazy loading failed] As I found out, the error only appears if the parent navigation does not exist in the database. Shouldn't I receive an empty navigation object in

How to populate a ManyToMany relationship using YAML on Play Framework 2.1.x

情到浓时终转凉″ 提交于 2019-12-23 12:54:40
问题 I have the following ManyToMany (bidirectional) relationship: @Entity public class Proposal extends Model { ... @ManyToMany public List<Tag> tags; } @Entity public class Tag extends Model { ... @ManyToMany(mappedBy="tags") public List<Proposal> taggedProposals; } And I want to populate my DB with some test data using a yaml file (to display later using a simple view). This is part of my yaml file: ... - &prop2 !!models.Proposal id: 2 title: Prop2 title proposer: *user2 - &prop3 !!models

Scala & Play! & Slick & PostgreSQL auto increment

拟墨画扇 提交于 2019-12-23 09:58:06
问题 I have the following code in Scala: case class Product(id: Option[Long] = None, name: String, price: BigDecimal, description: String) object Products extends Table[Product]("product") { def id = column[Long]("id", O.AutoInc, O.PrimaryKey) def name = column[String]("name", O.NotNull) def price = column[BigDecimal]("price", O.NotNull) def description = column[String]("description", O.NotNull) def * = id.? ~ name ~ price ~ description <>(Product.apply _, Product.unapply _) def autoInc = *

IntelliJ does not find native libraries for OpenCV when adding jar as a dependency for Play project

守給你的承諾、 提交于 2019-12-23 09:09:44
问题 I am currently working on a Play 2.1 project, in which requests to the web-service will handle downloading user-supplied images, re-sizing and re-cropping them, and also filtering out known bad photos (for example, we don't want users to upload company logos). We are trying to use OpenCV to handle the back-end work, but I can't seem to get IntelliJ to add the OpenCV jar in a way that works with the java project. I've been able to build OpenCV from source, without issue. This left me with the

Error starting fresh play 2.1 project

五迷三道 提交于 2019-12-23 07:55:31
问题 I am using play framework 2.1.0, I have created fresh project using command play new myfirstapp, then I selected 2 option to create simple java project and thus it created project Now when I start play by command play run I get following output C:\development\application\firstApp\helloworld>play run [info] Loading project definition from C:\development\application\firstApp\helloworld\project [info] Set current project to helloworld (in build file:/C:/development/application/firstApp