playframework-2.0

Play Framework 2 Render pdf

♀尐吖头ヾ 提交于 2019-12-23 12:14:43
问题 Is it possible to render pdf document with play framework 2? (There is a module that can render pdf for play 1.x. is there a way to render in play 2?) 回答1: If you're looking to render view templates as PDF documents, check out this module. 回答2: There is the apache fop plugin which create pdf out of fop files. The fop files are not the most intuitive files, but in the end I always found a way to format complex pdf the way I wanted it. To add the plug in to your play application add this to

Play Framework 2 Render pdf

时间秒杀一切 提交于 2019-12-23 12:13:12
问题 Is it possible to render pdf document with play framework 2? (There is a module that can render pdf for play 1.x. is there a way to render in play 2?) 回答1: If you're looking to render view templates as PDF documents, check out this module. 回答2: There is the apache fop plugin which create pdf out of fop files. The fop files are not the most intuitive files, but in the end I always found a way to format complex pdf the way I wanted it. To add the plug in to your play application add this to

Can Play 2.3.x be used without Activator (and with maven)?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 11:51:26
问题 I have two related questions here. In Play 2.2.x, the distribution was bundled as a zip file, and available for download through the maven repository http://downloads.typesafe.com/play/2.2.x/play-2.2.x.zip. This meant that you could use a pom.xml and embed play into your app without needing to use sbt. Given 2.3.x has shifted to the activator model, is it still possible to use it with maven? And secondly, is it possible to use play 2.3.x without activator at all? (I know they have a sbt

Scala reserved word as JSON field name with Json.writes[A] (Play equivalent for @SerializedName)

本秂侑毒 提交于 2019-12-23 09:48:31
问题 I'm producing JSON with Play 2.4.3 & Scala in the following fashion, providing an implicit Writes[DeviceJson] created with Json.writes . import play.api.libs.json.Json case class DeviceJson(name: String, serial: Long, type: String) object DeviceJson { implicit val writes = Json.writes[DeviceJson] } Of course, the above doesn't compile as I'm trying ot use the reserved word type as field name in the case class. In this scenario, what is the simplest way to output JSON field names such as type

Non-capturing wildcards in Play Framework routes

走远了吗. 提交于 2019-12-23 09:41:59
问题 I'm exposing an HTTP API through Play, and in order to manage compatibility-breaking changes, the URL contains the version number. At present this looks like the following: GET /api/v1/someMethod com.foo.Api.someMethod() As I introduce a change to the output of one of the methods, I'd like to support v2. For most of the methods though, the behaviour is identical, so I don't care which version is used. I tried to modify the above line to: GET /api/v:version/someMethod com.foo.Api.someMethod()

check that a result is an ok playframework

夙愿已清 提交于 2019-12-23 08:49:37
问题 I am trying to make a slightly better @Cached annotation by making it aware of the parameters of the function I call in my controllers. so I have this Action : public class ContextualCachedAction extends Action<ContextualCached> { @Override public Result call(Context ctx) throws Throwable { try { String key = makeKey(ctx); Integer duration = configuration.duration(); Result result = (Result) Cache.get(key); if (result == null) { result = delegate.call(ctx); //TODO find a way to cache only

Ebean looks for wrong sequence name in Play Framework 2

爱⌒轻易说出口 提交于 2019-12-23 07:20:19
问题 I have an id: @Column(name = "device") @GeneratedValue(strategy = GenerationType.AUTO, generator = "device_gen") @SequenceGenerator(name = "device_gen", sequenceName = "device_id") @Id public Integer id; SequenceGenerator defines the sequenceName as device_id but trying to save an entity I get the error: relation "public.device_seq" does not exist . Why is it looking for device_seq instead of device_id ? I'm using PostgreSQL 回答1: @GeneratedValue(strategy=GenerationType.SEQUENCE, generator=

Error when i try connect play with mysql 5.5 [duplicate]

旧街凉风 提交于 2019-12-23 05:51:41
问题 This question already has answers here : Steps needed to use MySQL database with Play framework 2.0 (10 answers) Closed 6 years ago . There is my configure : db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql:root:play2test" //Cannot connect to database [default] -> play mark this line db.default.user=root db.default.pass=123456 I already created play2test.mwb with MySql-workbench, i have tried other way like : db.default.driver="com.mysql.jdbc.Driver" db.default.url="jdbc

How do you update ManyToOne field in a form?

女生的网名这么多〃 提交于 2019-12-23 04:57:24
问题 The questions is all in the title :) Using Play! Framework 2.0, I have a Model with a ManyToOne field to an other Model. In the form, I show it with a Select id -> toString, but when I hit submit, I've got "Invalid value", because it expect an instance of that Model (I guess). How can I do this? Thanks for your help! 回答1: Name of this select must be set as property.id ie. if your model looks like @Entity public class Entry extends Model { @Id public Long id; public String title; @ManyToOne

Java Play2- Akka for jobs

蓝咒 提交于 2019-12-23 04:56:11
问题 I am trying to create a job in java play2 using akka. I always get the same error error: cannot find symbol And it points to system.actorOf() Intellij and Eclipse don't give me an error msg. But I can not find this method. I used the following imports import play.libs.Akka; import akka.actor.ActorSystem; import akka.actor.ActorRef; import akka.actor.UntypedActorFactory; import akka.actor.UntypedActor; import akka.actor.Props; import akka.actor.ActorRefFactory; Maybe the docs are outdated and