FAQ Database Discussion Community


Play Framework send message via rabbit mq

scala,rabbitmq,playframework-2.2
Does anybody out there using rabbitmq with Play Framework? I have an AI written in Scala using Play Framework. And I have a mean stack, which handles a nosql database. I'd like to send json messages via rabbitmq to that AI. I already got things going with nodejs and rabbitmq,...

PlayFramework 2.2.6. Default cache expiration

java,caching,playframework-2.2
I would like to store Java object in cache for user session. I would like to know what is default cache storage timeout. I user log in on 8.00 am I will store his user object in cache. Will it keep f.e. 10 hours until user will logout? Will be...

Nested form in Play! Scala 2.2

scala,nested-forms,playframework-2.2
I have read several times the documentation but I still have problems with my nested form in Play! Scala 2.2 (detailed further). Here is my form : <form method="post" action="/admin/test2"> first name : <input type="text" name="firstname"> <br> info 0 : <input type="text" name="label[0]"> <br> info 1 : <input type="text" name="label[1]">...

Play Framework 2.2.x and Angular: Redirect to mobile index page

angularjs,scala,httprequest,playframework-2.2
I'm working on an AngularJS project with the Play Framework 2.2. I'm supposed to develop a mobile version for the web application (not responsive, its part of a given uni project). For the desktop version I'm loading the index page with: def index(any: String) = Assets.at(path = "/public", file =...

yajsw play framewok ssl error

ssl,playframework-2.2,jks,yajsw
I am using yajsw to deploy a play framework application on a windows machine as a windows service. I am using these steps to install service. There is no problem with this method and working perfectly. However when I try to add a jks ssl file I get error. My...

Play Scala: json writer for nested classes

json,scala,playframework-2.2,playframework-json
I'm using Play! Scala 2.2 and I have a problem to render a class in Json : I have two classes with one depending of the other, as following : case class Artist(id: String, cover: String, website: List[String], link: String, Tracks: List[Track] = List()) case class Track(stream_url: String, title: String,...

Handle chunked data sent by Play scala with AngularJs

angularjs,scala,playframework-2.2,chunked,http-chunked
I send chunked data with Play Scala 2.2 to the client side like this : Ok.chunked(data) I would like to use them as soon as they are available on the client side. If I just get the data and print them on .success, they are printed at the same time...

Play 2.x Json transform json keys to camelCase from underscore case

json,playframework-2.2,playframework-2.3
I want to transform a json with underscore case keys to camel case keys. "{\"first_key\": \"first_value\", \"second_key\": {\"second_first_key\":\"second_first_value\"}}" to "{\"firstKey\": \"first_value\", \"secondKey\": {\"secondFirstKey\":\"second_first_value\"}}" This is partial code: val CamelCaseRegex = new Regex("(_.)") val jsonTransformer = (__).json.update( //converts json camel_case field names to Scala camelCase field names ) val jsonRet =...

Playframework base url replaced as “my-backend”?

playframework-2.2
I just launched a live version of my Play!framework project (2.2.x) and even if in local (dev), the url sents to me was correct (localhost:9100), when using ./activator stage then starting it, the urls are not what they should be (the url of my app), but instead, http://my-backend/ I modified...

How to handle FineUploader POST request in Java in PlayFramework?

multipartform-data,playframework-2.2,fine-uploader
I am trying to integrate FineUploader in my play framework code. View part is set up properly and it is working fine. I am not clear how to retrieve file in my controllers upload method. And other query parameters, qquuid, qqfilename, content-type e.tc. Following is the dump of file upload...

Anorm multi-value support doesn't work

scala,playframework-2.2,anorm
I have this weird issue with Anorm's multi-value support, my query doesn't return anything when I use Seq as written in documentation.. Here is my query: Controller def checkStock(data: Recap): Boolean = DB.withConnection { implicit conn => var so_id_list: Set[String] = Set() for(ls <- data.recap_items){ for(rs <- ls.invoice_items){ so_id_list =...

Error.invalid overwritten message in play framework

java,playframework,playframework-2.2
I'm working on a java Play Framework 2.2.3 project and i put some constraints on variables like that : @Constraints.Required(message = "Field required") public float prix; The only problem I have is that I've got an "error.invalid" (because it is a numeric field, otherwise I've an error.required matched with my...

Scala plugin for play framework 2

scala,plugins,sbt,playframework-2.2
Is there any official documentation how to create play framework 2 plugin in scala, I find this link but it is not clear for me. I actually need to add to play command like "play migrate", is it possible to do with just sbt? Appreciate any help.

Play framework and Java version

java,playframework,java-8,playframework-2.2
I would like to know if there is any connection between the play framework version (of my java app) to the java version of my app? Example: if I use play 2.2.1 and has java8 on my computer. Can I use java8 stuff in my code? If there is a...

Play2.2 Java - Prevent escaping on Javascript template

javascript,json,playframework,playframework-2.2,scala-template
Description: I'm trying to initialize a JSON object into my javascript template. View: views.tasks.task.js @() @import play.libs.Json @import enums.TaskType ... var taskTypes = @Html(@Json.stringify(TaskType.valuesJson())); Model: TaskType public enum TaskType { @EnumValue("General") GENERAL(1, "General", "label-info", "item-blue"); ... public static JsonNode valuesJson() { ArrayNode arr = Json.newObject().arrayNode(); for(TaskType tt: values()){ arr.add(tt.jsonNode()); }...

PlayFramework return absolute url in http instead of httpS?

java,nginx,playframework,playframework-2.2
I've implemented a project in Play!Framework with NGinx using only https. Everything works fine, the SSL is well recognized and I can use my app from anywhere but when Play! returns an absolute URL, it's in http, not https. This is problematic, and I don't know where the problem is....

Retrive a Json Response Android from Play

java,android,json,playframework-2.2
I have an application hosted on "heroku". It has this method you call it via a get and it will respond with a "Json code" public static Result renderManga(int id) { Manga m = Manga.find.byId(id); if (m != null) { return ok(Json.toJson(m)); } else return null; } } route file...

How intercept response and modify response body with play framework 2.2.x? [closed]

java,filter,httpresponse,playframework-2.2,interceptor
I need to intercept request and response. I have already intercepted request. But I cant intercept response and get response body with java. I need to intercept response in play framework 2.2.x with java

Play Scala : Recursive web services call without using Await.result

web-services,scala,recursion,playframework-2.2
I work with Play! Scala 2.2 and I need to make recursive web services call (until I get all the results). For the moment I managed to make it with Await.result as following : def getTitleSetFromJson( jsValue: JsValue ): Set[ String ] = { val titleReads: Reads[Option[String]] = (__ \\...

Play! Scala : Json reader and additionnal class field

json,scala,playframework-2.2
I'm using Play! Scala 2.2 and I'm reading json as following and it works great : case class YoutubeTrack(//artistId: String, videoId: String, title: String, thumbnail: Option[String] ) val youtubeTrackReads: Reads[YoutubeTrack] = ( (__ \ "id" \ "videoId").read[String] and (__ \ "snippet" \ "title").read[String] and (__ \ "snippet" \ "thumbnails" \...

Use save() method in Play! with inheritance (JPA)

java,jpa,playframework,playframework-2.2,playframework-2.3
I have my super abstract class : @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class User { @Id public int id; public String name; } And two other classes extends User: Customer @Entity @Table(name = "customers") public class Customer extends User{ @Id public int id; public String role; public Customer(String role){...

Setting logging level for FakeApplication

playframework,playframework-2.2,specs2
I am trying to configure the logging level of FakeApplication in my Specs2 test cases. However, the override isn't being picked up at all. It seems like it is always loading from logger.xml. Any thoughts how I can override the logging level for FakeApplication properly? Clarification: I am not too...

Getting cannot find file exception in play framework

file,scala,playframework-2.2,filenotfoundexception
I have a file called product.csv in my application root. I want to read from the file. But I am getting file not found exception. Here is the code I have written. val lines = scala.io.Source.fromFile("/product.csv").mkString println(lines) What am I doing wrong? EDIT BTW, I am using windows OS if...

When I select a row in MySQL using hibernate classes, it makes an update automatically

java,mysql,hibernate,playframework,playframework-2.2
I'm trying to develop a blacklist for my users including several variables. So when a user sign up in my application, I check if some parameters are blacklisted or not. The problem is that when I perform a select and the database find something that fits with my search, it...

Should I explicitly install Netty on my server?

playframework,playframework-2.2
I want to run my Play App in a production server, I know that it's kinda bundled with Netty server. I'm a noob here, but is there any performance enhancement if I explicitly install Netty on my server ?

Advanced HTTP server configurations in Play 2.3

playframework,playframework-2.0,playframework-2.2,playframework-2.1,playframework-2.3
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...