Questions tagged [playframework]

Play Framework is a modern open-source web framework for Java and Scala.

2
votes
2answers
54 views

How To iterate List[Result] and return one Boolean/Result?

I have a Future[List[Result]] I need to run a logic for example if all items in the list are Result.Ok then return Result.Ok (or true), else return Result.BadRequest (or false) I've tried: ...
0
votes
1answer
28 views

Play Framework 2.7.x Compile Time DI Error

Create project from https://github.com/playframework/play-socket.io/tree/master/samples/scala/chat and get compilation error overriding method applicationLifecycle in trait MyApplication of type =>...
0
votes
0answers
26 views

What's the newest Angular allowing a simple Play 2.7.x integration workflow?

I've been trying without success to find a way to integrate (Typescript-ed) Angular X with Play 2.7.x in a simple, clean way. By simple and clean I mean: The angular project can be developed from a ...
2
votes
2answers
34 views

Conditional filtering of JSON before deserialisation to case class model

How to parse a JSON conditionally before deserialisation to the following case class: case class UserInfo(id: String, startDate: String, endDate: String) I have an implicit reads object UserInfo { ...
0
votes
1answer
17 views

View make request to update with scala play framework [on hold]

I have a timer that goes off every 60 seconds to insert new data into my database, and I display that data in an HTML table in my view, however, new data keeps coming in the database yet my view does ...
0
votes
0answers
20 views

Swagger integration with Play2

I've followed https://github.com/swagger-api/swagger-play/blob/master/play-2.7/swagger-play2/README.md and integrated swagger-play2 version 1.7.1 with my play 2.7 app. When accessing /swagger.json ...
0
votes
0answers
20 views

play http request scoped cache for scala futures

I'm setting up a http request scoped cache for scala futures. As part of a single request, there are multiple expensive operations(REST API calls) whose results are returned in the response. There ...
0
votes
0answers
16 views

Lock DB row using UPDLOCK hint and run some code which needs to be synced across VMs

I am trying to take a UPDLOCK lock on a DB table row using scala slick and then execute some methods so that these method remain synced while I get the results. Is there a way of doing this using ...
1
vote
1answer
34 views

Is it good to use dependency injection in a java library?

I have a play application and want to take a common operation out from the application and make it as a library in order to use in other play applications. This proposing library has a contract(...
0
votes
1answer
26 views

What is the Main class in a Lagom/Play application?

I'm trying to figure out how to package and deploy my lagom app in production. The docs are surprisingly coy about how to actually do this, and when I try to use sbt-native-packager to run universal:...
0
votes
0answers
29 views

Angular 7: What's the updated systemjs.config.js?

How can I get a valid Angular 7 systemjs.config.js as detailed in the article: Setting Up Angular from Scratch and an updated systemjs.config.js version for Angular 6. I need this to be able to ...
0
votes
0answers
23 views

Scala Play: How to implement self web-scraping built in the App?

I'm working on a Scala 2.12.x Play 2.7.2 App and have the need to self web-scraping the static routes e.g. blogs, front-page text etc. Would there be a simpler way to do this rather than self web-...
0
votes
1answer
36 views

How to test a Play application using Guice and mocking custom ControllerComponents

I've started building a new Scala Play! app and I'm wondering how to test a controller that is defined as follows: class CustomController @Inject()( cc: SecuredControllerComponents, ...
0
votes
1answer
18 views

how to change json field value in the json level with Play json?

I have a simple case class that im working with in my app, and at some point im changing it to json and sending it to some api call, like this: import play.api.libs.json.{Json, OFormat} object ...
2
votes
1answer
45 views

How to filter JSON array results based on condition?

I'm using Scala Play 2.7.2 and have read ScalaJsonTransformers and ScalaJson. After calling a JSON API I get back (simplified MCVE) results like this: { "type": "searchset", "total": 5, "entry":...
1
vote
0answers
15 views

How to use 2 datasources with Ebean on a Play Framework 2.5 project?

I would like to split my default datasource to 2 different datasources (2 databases). I set my application.conf file: db { common.driver = org.mariadb.jdbc.Driver common.username = "root" ...
1
vote
0answers
17 views

error: not found: value PlayScala - sbt.compiler.EvalException: Type error in expression

My application Scala was working until a week ago, but I don't know what happened that it isn't anymore. I can't compile the application, every time I try the error bellow is showed name := """xxxx"""...
1
vote
2answers
58 views

Scala Future: Transform Future[Vector[T]] to Future[Result]

I have a method that creates a Future of type Vector from which I then want to create an appropriate HTTP response. I have tried to implement this so far using the transform and transformWith methods ...
1
vote
1answer
28 views

How to enable logging DEBUG-level only for the Application Controllers'?

I'm on Scala 2.12.x Play 2.7.x and as part of my Application Controllers I'm using the logger like this (or equivalently by doing with play.api.Logging): val logger = play.api.Logger(this.getClass) ...
3
votes
0answers
25 views

Cannot load grand-child routing from child module

Play Version [email protected] JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing) $ java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (build 1.8.0_212-b04)...
1
vote
0answers
81 views

Reactive web applications read twitter stream Play Scala

I am trying to follow the Twitter stream example of the Manning's Reactive Web applications The book is based on PlayFramework 2.5, however I would like to use a newer version of the framework, ...
0
votes
0answers
45 views

Scala Play: How to integrate and trigger Angular 7 components from view?

I'm working on a Scala 2.12.x Play 2.7.x and Silhouette ~v6.x project. I've also been looking at Scala-Play-Angular-Seed as starting point for what I'd like to accomplish which is to integrate Angular ...
1
vote
0answers
22 views

webassets doesn't work at sbt assembled fat jar ( docker )

Static file is work well in "sbt run". But it doesn't work in docker which is build by sbt assembly. I'm using Play 2.5.12 and I need serve only one static file so I add a file to public folder and ...
1
vote
0answers
34 views

Scala Play: What's the approach to externalize big JSON templates?

I'm working on a Scala 2.12.x Play 2.7.x project that calls a WS API and therefore, I have the need for storing big JSON templates with placeholders for reuse, something alla e.g. { "birthDate": "$...
0
votes
1answer
25 views

Multi-app project with Play Framework 2.5

I'd like to build a multi-app project with Play Framework 2.5 but I don't understand why a part of the project never compiles Here is the structure of the project: build.sbt (main sbt file) common/ (...
2
votes
1answer
63 views

Scala Play: Routes optional parameter with regex?

For one of my routes I have an optional parameter i.e. birthDate: Option[String] and can do this: GET /rest/api/findSomeone/:firstName/:lastName controllers.PeopleController.findSomeone(firstName: ...
0
votes
0answers
16 views

Play Framework error: where to find the log of 'This exception has been log with id {XXXXXXX}."

I'm using play 2.6 on docker. And now I'm facing the dread message Oops, an error occured This exception has been logged with id XXXXXXXX. I tried docker service logs but there is no detailed ...
0
votes
0answers
26 views

NoSuchElementException: key not found: domain.root

I am trying to run grid on my system, https://github.com/guardian/grid I have installed all the dependencies (sbt Java 8 node nginx Docker GD GraphicsMagick with little-cms2 ImageMagick pngquant ...
0
votes
0answers
16 views

How to debug the delay between Netty and Akka Default Dispatcher

I'm facing a significant delay(30-90 sec) between the time when Netty receives the request and the time when Akka's dispatcher starts executing the Controller's action. I'm using Play 2.5.2. The ...
0
votes
1answer
37 views

How can await util all messages was processed by actor in unit test?

I'm using Akka actor in our product. We wrote some code: @Singleton public class SingletonObj { private Map<String, Integer> cached = new HashMap(); public void set(String key,...
0
votes
0answers
7 views

Is there any way to pre-load creating connection in play-slick?

My project is sbt 1.1.6 + playframework 2.7 + play-slick 3.0.0 + mysql-connector-java 5.1.34. I started up the app by 1.sbt/dist 2.unzip {package} 3../bin/{project_name} -Dhttp.port=8080 I found ...
1
vote
1answer
63 views

Slick insert not working while trying to return inserted row

My goal here is to retrieve the Board entity upon insert. If the entity exists then I just want to return the existing object (which coincides with the argument of the add method). Otherwise I'd like ...
2
votes
2answers
44 views

Play Framework: No implicit format for Map

Using Play 2.5 I cannot seem to serialize a Map[SomeCaseClass, String] case class SomeCaseClass(value: String) implicit val formatSomeCaseClass = Json.format[SomeCaseClass] Json.toJson(Map[...
0
votes
0answers
12 views

Unit test controllers with Play 2.7 and Silhouette

I am trying to write unit tests for my controller class MyControllerSpec extends PlaySpec with MockitoSugar { implicit val sys = ActorSystem("MyTest") implicit val mat = ActorMaterializer() ...
1
vote
1answer
43 views

Does playframework release memory after a certain time?

I am new to Play Framework. I having been running Play Framework 2.7.x in production mode. Actually in the most simple code: package controllers import javax.inject._ import play.api._ import play....
0
votes
1answer
33 views

How write Reads function for Scala Play

I have problem with Reads. I have function like this: private val myFunc: Reads[Foo] = (__ \ "foo") .readNullable[Foo] .map { case Some(foo) => foo case None =>...
0
votes
0answers
16 views

AngularJs+Play Framework - How to read csrfToken from cookie when session cookies set to httpOnly=true

As per my audit requirement, all the session cookies should be httpOnly and secure. I did the same in play framework by setting application.session.httpOnly=true application.session.secure=...
1
vote
0answers
25 views

How to return a queryable sub-instance of a TableQuery?

I'm trying to build an function which takes an optional sort or filter attribute for a query and apply these on a TableQuery if the attribute exists, if not, returns something queryable on which I can ...
0
votes
1answer
46 views

Unable to convert XML string containing '&' or ';' to JSON object

I want to convert XML String to a JSON object. Below is the XML: <request> <Products> <Product> <ProductName>H &amp; M</ProductName> ...
1
vote
1answer
58 views

Create child actors based on the request pattern

I am trying to create a web socket server using Play Framework where response from server should be synchronous or asynchronous based on request. The request will be processed in Parent actor .Based ...
0
votes
0answers
35 views

Need to create duplicate Index to make query faster

I have a weird situation that sometimes my web application (Running on Play 1.5 framework) stop fetching results to a particular query. So after keep trying few minutes, the web server returns timeout....
0
votes
0answers
21 views

How to create new chat room with play framework websocket?

I tried the chat example with websocket in play framework 2.6.x. It works fine. Now for the real application, I need to create multiple chat rooms based on user requests. And users will be able to ...
5
votes
1answer
137 views

How to setup sbt/scala/play multi-module project which will work fine with Intellij scala plugin

I'm setting up a new multi-module project (sbt/scala/play/IntejjiJ) and I would like to have two things: A multi-module project with one build.sbt file with this layout project |_Dependencies.scala ...
0
votes
1answer
39 views

How to do Method/Field Injection in Scala using Guice?

I am trying to do either method or field injection in Scala. I am using the Play Framework, which uses Guice for injecting. I have tried field injection like: @Inject val cache: DefaultSyncCacheApi =...
0
votes
1answer
25 views

Sending message to Play Controller from Child Actors

I am not clear on how to pass a message to an actor which has a constructor taking actorRef as argument. I am trying to implement a simple websocket server using Play Framework. I am receiving the ...
1
vote
1answer
42 views

Dependency Injection on Class Instantiated Elsewhere

I am trying to inject ehcache via the Play Framework. I am injecting it into a companion class, but that class is being instantiated in an abstract class elsewhere as well as the companion object. I ...
2
votes
1answer
24 views

Custom defined form Constraint throws a null pointer exception

I have a problem with defining a custom Constraint on my form. This is my form: val form = Form( mapping( "field" -> boolean )(MyForm.apply)(MyForm.unapply) If I do the following: val form ...
0
votes
0answers
26 views

Load application context in controller tests using Play and scalatest (+specs2)

I have a Play application and I am trying to develop some unit tests for my controllers using scalatest (also tried using specs2). I am not well versed in the Play framework. For testing I am using ...
0
votes
1answer
32 views

Hot reloading of Play Framework (2.4), sbt (0.13.17) and reason for complete project being entirely recompiled

Something seems currently wrong with my web application project and its internal dependencies: if I modify the body of a public, non-static Java method for certain classes, my whole project gets ...
0
votes
1answer
46 views

Is there a problem in mixing @Transactional with “jpaApi.withTransaction”?

I was having some trouble making transactions work properly in my play application, and my code is structured in such a way that I cannot afford the time to do it "properly" as it shows in the Play ...