playframework

Create an Instance of class which does DI via Playframework Guice Independently in Scala

假装没事ソ 提交于 2020-01-05 04:23:21
问题 I'm working on Playframework2.5 with play-slick and programs related to it such as batch. current project structure is like /rootPlayProject /app /controllers /filters /services ... Modules /core (sub-project - DAOs,services are placed here) /batch (sub-project depends on core) I'm using Guice DI almost everywhere include Database Access Object(DAO). And interfaces in core are bound in Module placed in core which end up getting inherited by Module in root project. Core Module(/rootPlayProject

PersistenceException: ERROR executing DML bindLog[] error[Field 'id' doesn't have a default value]

て烟熏妆下的殇ゞ 提交于 2020-01-05 02:42:47
问题 I'm trying to use MySQL and ebeans for saving my tasks. When i apply the script, i get this error : [PersistenceException: ERROR executing DML bindLog[] error[Field 'id' doesn't have a default value]] Before using MySQL as DB, it worked fine with H2 DB in memory as well as File system... How can I resolve this error? 回答1: just got the same error. add AUTO_INCREMENT to your id field and the constraint in your evolution script.Like this create table name ( id bigint not null AUTO_INCREMENT, ...

How to replace all the values with the same key in a JSON tree

假装没事ソ 提交于 2020-01-04 20:30:20
问题 Before storing any JSON document in MongoDB, I need to transform all the string id s in the document into BSON id s and, vice-versa, when reading any document from MongoDB, I need to transform all the BSON id s into string id . That said, given the following JSON... { "id" : "52fe942b790000790079b7d0", "email" : "joe@domain.com", "username" : "joe", "subscriptions" : [ { "accountId" : "72fe942b790000790079b755", "name" : "test 1", "isDefault" : true }, { "accountId" :

Setup CORS on Java Playframework 2.4.x + AngularJS

一世执手 提交于 2020-01-04 14:36:27
问题 I am trying to setup CORS in java playframework 2.4.x withouth success. My front-end app is using AngularJS 1.3.x. I implemented the Filters class as per documentation but my preflights OPTIONS requests from AngularJS fail without apparent reason. This is my application.conf values regarding the filter: NOTE: I edited the domain names (I am not the owner of example.com) ;) ... play.filters.cors { allowedOrigins = ["http://example.com", "http://beta.example.com", "http://example.com/beta"]

Wrong Charset Encoding with Play Framework 2.1

拟墨画扇 提交于 2020-01-04 14:22:12
问题 I have a web service that receives a parameter in ISO-8859-1 encoding. But when I try to read it from the request, I get this characters: ����� I've tryied all these approaches, but none of the convert the given string to the expected one (áéíóú): val a = new String(_html.getBytes()); val b = new String(_html.getBytes(), "UTF-8") val c = new String(_html.getBytes(), "ISO-8859-1") val d = new String(_html.getBytes("ISO-8859-1"), "UTF-8") val e = new String(_html.getBytes("ISO-8859-1"), "ISO

Sbt: Unresolvable webjar dependencies

若如初见. 提交于 2020-01-04 10:58:11
问题 I've created new play framework app using a angular-seed-play-java template. So now I'm trying to install Babel as a transpiler. Following these instructions I've added sbt-babeljs to my plugins.sbt https://github.com/stonexx/sbt-babeljs . Then I want to install bubel-core locally. I got a webjar from the http://www.webjars.org/ and inserted the following line into my build.sbt . "org.webjars.npm" % "babel-core" % "6.11.4" I'm getting unresolved dependency error: [error] (*:update) sbt

Getting a Play JSON JsValueWrapper for a class that extends a trait

左心房为你撑大大i 提交于 2020-01-04 09:27:11
问题 I'm generating JSON for a speed where the units may vary. I have a SpeedUnit trait and classes that extend it (Knots, MetersPerSecond, MilesPerHour). The JSON Play documentation said "To convert your own models to JsValues, you must define implicit Writes converters and provide them in scope." I got that to work in most places but not when I had a class extending a trait. What am I doing wrong? Or is there an Enum variant I could or should have used instead? // Type mismatch: found (String,

Install Play! with activator on linux

霸气de小男生 提交于 2020-01-04 08:15:23
问题 I'm new with the framework Play! and Linux and I'm trying to install Play! scala. I'm following the official tutorial (official play! tutorial) But I have this problem : when I run this command : $ activator new my-first-app play-scala I have this warning : The program 'new' is currently not installed. You can install it by typing: sudo apt-get install nmh And when I run sudo apt-get install nmh It's said : nmh is already the newest version. (and I still have the same problem) I also tried to

Install Play! with activator on linux

对着背影说爱祢 提交于 2020-01-04 08:15:10
问题 I'm new with the framework Play! and Linux and I'm trying to install Play! scala. I'm following the official tutorial (official play! tutorial) But I have this problem : when I run this command : $ activator new my-first-app play-scala I have this warning : The program 'new' is currently not installed. You can install it by typing: sudo apt-get install nmh And when I run sudo apt-get install nmh It's said : nmh is already the newest version. (and I still have the same problem) I also tried to

My Play! Application doesn't have an application.log

江枫思渺然 提交于 2020-01-04 05:58:32
问题 I got an error message saying: This exception has been logged with id 1mhqg4onc But I don't see this exception in the logs. I only have myapp.DEBUG , myapp.ERROR , myapp.FATAL , myapp.INFO , myapp.TRACE and myapp.WARN in my myapp/logs directory. I thought application.log was just supposed to be there by default. It's in my local machine but not when I deploy to production and that's where this exception is happening. I tried adding a file at conf/application-logger.xml with the default