playframework-2.3

Post JSON-Data from PlayFramework form

 ̄綄美尐妖づ 提交于 2019-12-11 10:12:03
问题 Play Framework provides a way to access JSON-Data in a request-body via request().body().asJson() . Using form-helpers does not post data in JSON-format. So, what is the best way, in a play-application, to convert the form-data to a json-object before passing it to the controller? Thanks in advance. 回答1: When you retrieve request payload data you can use either BodyParsers (they use the Content-Type header to parse the payload into something else) or you can get the payload yourself via form

Advanced HTTP server configurations in Play 2.3

扶醉桌前 提交于 2019-12-11 09:09:27
问题 I am using Play 2.3 to develop an application. I need to set http.netty.log.wire to true which is by default false as specified in Play documents. In the below link (last section) it says this option is available but it also specifies "we cannot use application.conf" to specify this. https://www.playframework.com/documentation/2.3.x/ProductionConfiguration If we cannot specify this in application conf, how can we specify this? Thanks 回答1: You will need to pass those options in the command

Play 2.3.7 sbt multiproject compiler issue

社会主义新天地 提交于 2019-12-11 07:17:36
问题 we're using Play framework 2.3.7 and have set up a multiproject with sbt (sbt version 0.13.5), which is consisting of four modules. In the build.sbt file of the project root we define the modules: lazy val common = (project in file("modules/common")).enablePlugins(PlayJava, SbtWeb) lazy val store = (project in file("modules/store")).enablePlugins(PlayJava, SbtWeb).dependsOn(common) lazy val catalog = (project in file("modules/catalog")).enablePlugins(PlayJava, SbtWeb).dependsOn(common) lazy

How do I extract the value of a route variable from the URL in a Scala-Play app?

若如初见. 提交于 2019-12-11 04:05:11
问题 I am writing a module for the Play Framework. In part of my module I have the following code abstract class SecurityFiltering extends GlobalSettings{ override def onRequestReceived(request: RequestHeader) = { play.Logger.debug("onRequestReceived: " + request) super.onRequestReceived(request) } override def doFilter(next: RequestHeader => Handler): (RequestHeader => Handler) = { request => { play.Logger.debug("doFilter: " + request) super.doFilter(next)(request) } } override def onRouteRequest

How to set up jacoco4sbt to process classes in main and submodules in Play?

北城余情 提交于 2019-12-11 03:59:19
问题 I'm having some problems to make jacoco4sbt working with my Play 2.3.4 project. My project is composed of 3 submodules: common , api and frontend and has no code in the app root folder. Now when I run Jacoco it does not find the submodules classes. Inspecting target/scala-VERSION/classes I only find some routing classes (which in fact is the only code I have in my "root" project, but I was expecting that because I aggregate all those projects the classes would be there). If I copy the classes

JNotify preventing execution of Play Application

为君一笑 提交于 2019-12-11 03:44:56
问题 Prior to upgrading, our application was at v2.1.1 and I was getting warnings about the absence of JNotify. No harm no foul as far as I could tell. However, after migrating to v2.3.1, the warning has turned into a show-stopping exception. I compile and then attempt to run and receive the following output: java.lang.NoClassDefFoundError: Could not initialize class net.contentobjects.jnotify.JNotify at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect

Play Framework nested form errors missing

一个人想着一个人 提交于 2019-12-11 03:06:40
问题 I am using Play Framework 2.3 with Java and I have the following one-to-many relationship between a committee and its recorded meeting dates: @Entity public class Committee { @Id protected Long id; @OneToMany(cascade=CascadeType.ALL, mappedBy="committee", orphanRemoval=true) private List<MeetingDate> meetingDates; } @Entity public class MeetingDate { @Id private Long id; @Constraints.Required @JoinColumn(nullable=false) @ManyToOne private Committee committee; @Constraints.Required @Formats

Play Framework: package play.db.jpa not found

删除回忆录丶 提交于 2019-12-11 02:57:24
问题 I am trying to create a play 2.3.4 application with Spring Data JPA. This tutorial says it is good practice to let my model class inherit from play.db.jpa.Model . Therefore I added import play.db.jpa.* to my code and let my model class to extend from Model , However, when I reloaded the application, I got an error message, that Model is an unknown symbol. Anybody knows how to inherit from Model ? 回答1: play.db.jpa.Model does not exists in Play2 (there is only a Model class for Ebean ORM). So

Play framework (2.3.5) - Template accessing an inner class fails

南楼画角 提交于 2019-12-11 02:33:57
问题 I have a class defined like so (pseudo code): package com.some.namespace public class SomeClass { protected SomeClass() {} // stuff... public class SomeInnerClass { public SomeInnerClass() {} // more stuff (accesses instance variables from SomeClass)... } } Then in my template I use the reusable block defines like so: @doSomething(val: com.some.namespace.SomeClass.SomeInnerClass) = { // even more stuff... } But I get the error: type SomeInnerClass is not a member of object com.some.namespace

Play 2.3 Java - Set header on all responses

我与影子孤独终老i 提交于 2019-12-11 00:29:24
问题 I am using Play 2.3.0 together with Java 8 and want to set some headers in all requests. I have already found Stackoverflow-answers for the similar question for Scala, but I didn't manage to convert this example into the Java world: import play.api._ import play.api.mvc._ import play.api.Play.current import play.api.http.HeaderNames._ object Global extends GlobalSettings { def NoCache(action: EssentialAction): EssentialAction = EssentialAction { request => action(request).map(_.withHeaders