playframework,annotations,http-headers,playframework-2.0
Aside from putting the setHeader(...) methods in a utility method and calling it from each action to reduce code duplication, there is not much to improve on your solution (sadly). Both action composition and global intercepts only work well for a @Before type case, especially if you want to pass...
scala,playframework,playframework-2.0,scalastyle
Any suggestions on a good solution for this? Or do we just have to turn of this check for Play projects? I'd suggest to either turn org.scalastyle.scalariform.PublicMethodsHaveTypeChecker rule off completely for your project or mark your controllers to be ignored by this rule (here you'll find info on how...
scala,playframework,playframework-2.0,actionbuilder
I think Scala can't work out what you mean by: ActionBuilder2 andThen ActionBuilder1 { // Some block } so the easiest way seems to be declaring that chain as a thing in its own right, then applying the block to it: val actionChain = ActionBuilder2 andThen ActionBuilder1 def yolo =...
scala,playframework,playframework-2.0
So where is the data coming from? For selects I use MyEnum extends Enumeration, and my MyEnum class has a method like: def toHtml: Vector[(String, String)] = ("", "") +: super.values.toVector.map(m => (m.id.toString, m.toString)) To add a blank option on top of all selects. ...
scala,playframework-2.0,slick,slick-2.0
so I found in Slick 2.0 ... MyClass.query.baseTableRow.tableName where class MyClass(tag: Tag) extends Table[MyCaseClass](tag, "table_name"){ def id = column[Long]("id", O.PrimaryKey, O.AutoInc) ... def * = (id.? , ...) <> ((MyCaseClass.apply _).tupled, MyCaseClass.unapply) } ...
as m-z said in the comments, change val t = rqForm.bindFromRequest.fold( formWithErrors => BadRequest("That's not good"), rq => Ok((views.html.properForm("POST tweets TBD.")(Html("<em>Blah</em>")))) ) // expect a play.api.mvc.Result println(t.getClass.getName) // this confirms it in both run-time cases t match { case v:Result => v } // yet this is required for compile...
javascript,scala,cookies,playframework,playframework-2.0
According to the docs, the constructor for Cookie takes a boolean parameter named httpCookie. The default value is true. HttpOnly cookies cannot be seen by javascript. So, if you want to delete your cookie from javascript, try setting this to false. val cookie:Cookie = new Cookie(sCookieID, sValue, Option(nSecondsExpire), httpOnly =...
This should do the trick: play '-Dhttp.port=9090' 'start 9090' or activator '-Dhttp.port=9090' 'start 9090' at least that was working some time ago, see this answer The behavior varies on exact Play version, anyway you need to test several versions (always with quotes) so finally you'll find the solution, unfortunately I...
json,scala,playframework,playframework-2.0
The proper way to do this with JSON combinators is to use orElse. Each piece of the combinator must be a Reads[YourType], so if/else doesn't quite work because your if clause doesn't return a Boolean, it returns Reads[PlaylistItemInfo] checked against null which will always be true. orElse let's us combine...
scala,module,compiler-errors,routes,playframework-2.0
With thanks to @Sarvesh Kumar Singh for directing me to the page on "SubProjects", the solution was relatively simple. Rename "routes" in the the module source to "barcode.routes". Redo activator publish-local. In the "Test" project route file, include the required line as -> /barcode barcode.Routes (Note the last "R" in...
javascript,jquery,cookies,playframework-2.0,session-cookies
You do not need to check cookie in front-end, and actually you should not to it especially if you care for security. Your backend action should return ok() Result in case when everything's ok. If user is unlogged you can return unathorized() (Unathorized() in Scala). than in your jQuery you...
java,playframework,playframework-2.0,reactive-programming
Your getContentLength method is incorrect, because it returns negative lengths: MP3 size = 12000 from = 0 to = 5000 getContentLength = -4999 Fix this method and it should work. Apart from that, you should note that range and chunks are static fields, and you may face concurrency problems. Also...
forms,scala,validation,playframework-2.0
First things first, I'd get rid of the confirm_email and confirm_password fields since they're redundant in the Data model. After this operation, it'll look like this: case class Data( firstName: String, lastName: String, email: String, password: String) Next, your form mapping needs to be updated: val form = Form[Data]( mapping(...
scala,intellij-idea,playframework-2.0,typesafe-activator,typesafe-stack
My problem is resolbved. As Sarvesh Kumar Singh mentioned I have created activator project and open that project in In Intellij IDEA and used options Auto import and download sources. Above option resolved my problem. ...
It's an architectural choice that was made by the developers. There are certain components of the framework that require a reference to an Application (typically the current running Application). The Cache, DB, Messages (i18n), Evolutions, and WS API are the first ones that come to mind. The Application trait is...
scala,playframework-2.0,playframework-json
If you already have an Option, and you don't want to use the value in certain cases, then filter is your most idiomatic choice: val one = Option("1") val zero = Option("0") one.filter(_ != "0") //Some("1") zero.filter(_ != "0") //None Using this method, your solution would be: (obj \ "approx_pieces").asOpt[String].filter(_...
Sounds like you want to use some kind of cron task (correct me if I'm wrong) In Play 2.x it's done with Akka's scheduler mentioned in the docs Even more informations and/or samples you can find on the original Akka's docs In general: in Play you can just schedule some...
First the error java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object; is not from Anorm but from Predef: the -> operator is not found to build tupple, which is quite weird. I would suggest to check your scala version and dependencies, to be sure there is not several scala lib pulled. Then if you want to...
java,orm,playframework-2.0,ebean
Just use a RawSql query; once you start joining and adding lots of clauses, things get out of hand pretty quickly. At that point it gets really easy to write a query that's hard to debug and even harder to modify in the future. In the end, your query still...
java,cookies,playframework-2.0
You're reading cookies from the response, not the request. The response will only show cookies that you've set in the current request, since cookies are only sent in a response when you set them. If you want to see all the incoming cookies, you need to iterate over the cookies...
java,scala,playframework-2.0,sbt,typesafe-activator
public void Login(String usrnm, String psswrd){ username = usrnm; password = psswrd; } This is not a constructor. Remove void keyword. Keep in mind, not having a default constructor for a form will result in runtime exceptions....
playframework-2.0,sbt,typesafe-activator,activator
What caused this? Still no clue. But just deleting the .sbt folder in the root directory made sbt refresh everything from scratch. All projects now work properly again.
playframework-2.0,ionic-framework
get the intel xdk, here: https://software.intel.com/en-us/html5/tools#download, it has a built in emulator that can simulate ios and android. Just import your project and click the emulate tab. Also has a built in text editor (brackets) a on device debugger, a test server for remotely testing on devices, and a build...
scala,playframework,dependency-injection,playframework-2.0
Looks close. Change val to var because it is not final and needs to be injected at a latter stage. @Inject var mailer: MailerClient = null I'd check also that the MailerClient library is mentioned as a dependency in the project configuration. You could try with WSClient instead as it's...
You can use the Play2War plugin for Play 2.2.x https://github.com/play2war/play2-war-plugin/ Current versions: Play 2.2.x : 1.2 Play 2.3.0 -> 2.3.1 : 1.3-beta1 (Scala 2.10 & 2.11) Play 2.3.2+ : 1.3-beta3 (Scala 2.10 & 2.11) ...
Looks like you are trying to send a List of Locations. You could do: def locations = Action {implicit c=> import play.api.libs.json._ implicit val locationFmt = Json.format[Location] case class Location(city: String, state: String) //Send Multiple Locations if you want val readLocations = SQL("select city,state from zips").list.map{case Row(city: String, state: String)...
Typically you would only use flash data with redirects, where you would otherwise not be able to render any data until the next request. And after that, the data is gone. For example, when the user logs out of my application, I might redirect them back to the login page,...
The problem seems to be not the @routes syntax (which you have completely correct) but rather a case of the Twirl engine not seeing where code ends and HTML begins (or something like that anyway...) The line you've included, which has both a var and a semicolon, made me suspect...
scala,playframework,playframework-2.0
If you're applying loginMenu as an argument to main you don't need the @ in front of it, since you're already in a Scala code block. Try: @main("Welcome to Play", "Home")(loginMenu()) { <div class="container"> <h2>Home</h2> </div> } ...
json,scala,validation,playframework-2.0
(JsPath \ "artWorkid").read(minLength[String](1)) it worked for me...
playframework,playframework-2.0,akka
The problem you are facing goes beyond development changes in files. You want your actor to be able to hold the state no matter what happens to the play application (maybe it failed for different reason?). Basically you want your scheduling actor to be persistent. It is very easy to...
eclipse,playframework-2.0,dart,dart-pub,typesafe-activator
I guess the best way is to use a proxy with rules to forward requests for Dart resources to pub serve and play resources to activator. This would be simple to build in Dart for example using shelf, shelf_route and shelf_proxy or nginx with a few forwarding rules.
scala,playframework,playframework-2.0
According to Play documentation If you have an implicit Request in the scope, it will provide an implicit Lang value corresponding to the preferred language extracted from the Accept-Language header and matching one of the application supported languages. So you need to change your action to def createView = Action...
scala,playframework-2.0,playframework-2.3
You can't reference other form fields within the same mapping until after they all successfully bind individually. That is, the constraint must be made on the outer mapping. val policyForm: Form[PolicyForm] = Form { mapping( "amount" -> of[Double].verifying(...), "beginDate" -> date("yyyy-MM-dd").verifying(...), "endDate" -> date("yyyy-MM-dd") )(PolicyForm.apply _)(PolicyForm.unapply _).verifying("End date has be...
mongodb,scala,playframework,playframework-2.0,reactivemongo
You can make things easier by creating 2 case classes. One to be used when data entry is in place case class PersonData(name: String, city: String) and another one to represent real Person in your model case class Person(_id: BSONObjectID, name: String, city: String) and in Person object create method:...
java,forms,scala,playframework,playframework-2.0
The 'id is a Symbol. You could use the Symbol("sym") syntax if you don't like this one, but it is not standard. scala> 'symbol == Symbol("symbol") res0: Boolean = true ...
I solved problem adding the following imports in controller file: import play.api.i18n.Messages.Implicits._ import play.api.Play.current See Play 2.4 migration: https://www.playframework.com/documentation/2.4.x/Migration24#I18n Update Actually this is a bad way cause here used Play.current which will become deprecated soon. Here another solution using dependency injection: routes: GET /archive/new @controllers.Application.addPost POST /archive @controllers.Application.createPost controller: class...
playframework,playframework-2.0,typesafe-activator
Have a look at Sbt-filter. It's a plugin to filter which files are included in your dist and which one are not. You can add the filters to your build.sbt. you have to enable the filter plugin by adding it to your pipeline stages: lazy val root = (project in...
Create a column in table say image_name set its default value say default.png. Create a folder in public folder say images. Save a default image in /public/images/default.png (same name as default name saved to database).So if the the user dint have any uploaded image a default image is shown....
scala,asynchronous,playframework-2.0
Action.async is not enough to make your code asynchronous. Here is the signature for async (I picked the simplest overload): def async(block: => Future[Result]): Action[AnyContent] It's up to you to provide that Future. If you're calling blocking code you can execute it concurrently like Future { blockingCode() }. However the...
I thing that you shoul change your code by this: def putInMap(obj: SignUp) = { val signupMap = Map( "firstname" -> obj.firstNname, "lastname" -> obj.lastName, "email" -> obj.email, "secondryemail" -> obj.secondryEmail.getOrElse("") ) signupMap } Use getOrElse to access a value or a default when no value is present: the empty...
Well... that's because the Scala language promotes the idea of immutability, and hence Keeping this spirit WsRequestHolder is also kind of immutable. So... withHeaders does not mutate the current WsRequestHolder but returns a new instance of WsRequestHolder which has provided headers. Another reason for this kind of implementation is to...
You have same type of list variable in both entity having Many-To-Many relation .Change List type to Gin in Tonic class .Do @Entity public class Gin extends Model { @Id @Column(name="idGin") private Integer idGin; private String aroma; ...// some other vars from the database not important @ManyToMany @JoinTable(name="gin2tonic") private List<Tonic>...
json,scala,validation,playframework-2.0,playframework-2.3
Well, it's not pretty, but I think something like this should work... Let's assume isNameAvailable is a function that ensures that the name is not already in use by another dashboard, and returns true if name is available (false otherwise). import play.api.data.validation.ValidationError implicit val reads: Reads[UpdateDashboardModel] = ( (JsPath \...
In accordance with the documentation Play uses the MessageFormat class for formatting and it generates its output based on the provided Locale object. Hence, the thousand separator is used in your example. The simplest solution is to pass the string value instead the number. Messages.get("myerror.number", String.valueOf(5)); Play doesn't provide any...
If you check out the documentation, you will see that this is of type (String, String)*. First (T1,T2) stands for Tuple2[T1,T2]. Second, the * stands for a variable length argument, meaning that it accepts as many Tuple2's that you want to send. This could be a List or another type...
java,css,intellij-idea,playframework,playframework-2.0
You should add desired style to your CSS style sheet and create a custom form helper that will feet your needs. Here is a simplest example of a custom customInputText.scala.html file based on the docs: @(elements: helper.FieldElements) <div> <label for="@elements.id">@elements.label</label> <div> @elements.input <span class="errors">@elements.errors.mkString(", ")</span> </div> </div> And in your...
json,scala,playframework,playframework-2.0,scala-2.10
If your eventual goal is to parse this into case classes, just define those case classes and let Play do the heavy lifting. case class Renting(name: String, pets: String) case class Resident(renting: List[Renting]) case class Location(residents: List[Resident]) implicit val rentingFormat = Json.format[Renting] implicit val residentFormat = Json.format[Resident] implicit val locationFormat...
json,scala,playframework-2.0,implicit
You need to include an implicit roleFormat in your EmailInvitationDTO object declaration. The Json.format macro looks for implicit Json formats at compile time, otherwise it will have no idea how to read/write the RoleDTO in your EmailInvitationDTO. So you'll need the following line in scope before creating an emailInvitationFormat: implicit...
java,build,playframework-2.0,sbt,dependency-management
This looks like a failure to reload the project definition within activator. If I update my build.sbt with the following, the project will still compile correctly not because there are no problems with the dependency but because it doesn't know about the changes. libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, javaWs,...
playframework,playframework-2.0,playframework-2.2,playframework-2.1,playframework-2.3
You will need to pass those options in the command line: /path/to/your/app/bin/yourapp -Dhttp.netty.log.wire=true ...
playframework,playframework-2.0
To make the cookie be accessible through 'document.cookie' I had to set the 'httpOnly' flag to 'false' (which is default on 'true', the last parameter) ! .....withCookies(Cookie("key", "value", None, "/", None, false, false)) ...
java,playframework,playframework-2.0
You should keep uploaded files apart the application structure at all, so just create dedicated directory in the file system and store uploaded files in it. TIP: you can (should?) add custom directive to application.conf so you won't need to hardcode the path into your controller and will be able...
When you start the console with h2-browser command then it runs until you exit from activator. Like this: activator -jvm-debug 9999 h2-browser run ...
json,scala,playframework,playframework-2.0
You'd be a lot better off avoiding Map[String, Any], and Scala and Play make this easy. A much better solution is to define a custom case class for the thing you're trying to represent as a map: import play.api.libs.json._ case class Doc(name: String, level: Int, marked: Boolean) case class Foo(id:...
java,hibernate,playframework-2.0
It turns out that the tutorial Play posts is specific to their H2 database system. As a noob, I missed the fact that you need to tell Hibernate what dialect to use. In the persistence.xml, I changed the dialect line to this: <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> Seems my problems are now...
json,scala,testing,playframework,playframework-2.0
By default, the Content-Type header gets overridden by the framework. A workaround is given in the blog In your case, this should work route(FakeRequest(POST, "/bob", FakeHeaders(Seq(CONTENT_TYPE->Seq("application/json"))), jsonStr))(Writeable(_.getBytes, None)).get For multiple tests, an implicit can be created in the beginning for the writable and it need not to be passed in...
intellij-idea,playframework-2.0
Usually I compile and run through console: activator -> compile/run, but you can compile in Intellij too by running Build -> Make Project, but I never tried running Play in Intellij though. And for debugging, I run command activator -jvm-debug 9999 run as said in documentation. Then I set up...
scala,playframework,playframework-2.0
It seems you didn't import your commentFormat in object serviceTaskFormat. Try this: object ServiceTask { import Comment._ implicit val serviceTaskFormat: Format[ServiceTask] = ( (JsPath \ "id").formatNullable[String] and (JsPath \ "name").format[String] and (JsPath \ "description").format[String] and (JsPath \ "requiredInfo").format[String] and (JsPath \ "status").format[String] and (JsPath \ "approved").format[Boolean] and (JsPath \ "comments").formatNullable[Seq[Comment]]...
logging,playframework-2.0,akka
I think I had pretty much the same problem couple of days ago. In my case I was able to find out in the stacktrace that actor system was shutting down die to NullPointerException. In order to prevent JVM from shutting down you should add: akka.jvm-exit-on-fatal-error = false play.akka.jvm-exit-on-fatal-error =...
What you see in project/target is the Scala version used by the build system. Those artifacts are not the result of your project's code but rather the build system. The artifacts in target are from your code. In any case, you can determine the Scala version in use with the...
scala,playframework,playframework-2.0,slick,slick-2.0
Great question - I was in the same boat as you! I'd have just the DAO and this code: TableQuery[UsersTable].schema.create which'll create the database table for you. No need for the .sql. Correspondingly, to drop, use .drop instead of .create. You can also combine table creation of several tables using...
scala,cookies,asynchronous,playframework,playframework-2.0
Put the next async call (Future) inside the for comprehension. This way you can chain the calls. Let's say that Page.load() returns Future[Page], in the code below the page value will be Page not Future[Page]. This way Page.load() is called after the getAuthCookies method. ... implicit val ctx = RequestContext.createFromRequest(request)...
scala,testing,routing,playframework-2.0
Try setting application.router of FakeApplication to submodule's route file. For example: class SubModuleRouteSpec extends PlaySpecification with After { lazy val app = FakeApplication(additionalConfiguration = Map("application.router" -> "sub.Routes")) "SubModule route" should { "Get Action" in new WithApplication(app) { val result = route(FakeRequest(GET, "/bob/11")).get println(contentAsString(result)) result must not beNull } } override...
Native support for play is currently in the works for Gradle. This is still in development, but you can take a look at some sample projects in the samples/play directory of the 'all' distribution of Gradle 2.3.
java,playframework,playframework-2.0,ebean,playframework-2.3
You can create ManyToMany relation between Cars and User .Like @Entity public class Car extends Model{ //other fields @ManyToMany public List<User> users=new ArrayList<User>(); } @Entity public class User extends Model{ //other fields @ManyToMany public List<Car> users=new ArrayList<Car>(); } The above code will automatically create a third table say User_Cars(you can...
plugins.sbt are plugins for your build, ie, for sbt. They get loaded and run by sbt when you build your app. For example, the sbt less plugin compiles less files at build time. When you deploy your app, the less plugin is not needed, because the less files have already...
scala,playframework-2.0,future
You are missing two Future concepts in your solution: flatMap and Future.sequence To explain each: flatMap is like map except instead of giving it a function from future.map(A => B) you give it a function from future.flatMap(A => Future[B]). This way you can chain Futures together. Future.sequence is a helper...
scala,ubuntu,playframework-2.0,server,production
Have you tried to press CTRL+D after the server is started? Please read this: https://www.playframework.com/documentation/2.3.7/Production...
scala,model-view-controller,playframework,playframework-2.0,typesafe-activator
You can't use the value of the form as a parameter for the route: @form(routes.Users.updatePassword(userForm.userid.get)) The userid depends on the form and could therefore change. In any case, you would access the userid of the form using userForm("userid") and not userForm.userid (although it might not be what you want/need). A...
should be add as libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.16" in build.sbt, but not as addSbtPlugin("org.sorm-framework" % "sorm" % "0.3.14") in project/plugins.sbt...
scala,playframework,playframework-2.0
Play 2.4, by default, generates a dependency injected router, unlike previously, when it used a static router. You have two options, remove the routesGenerator line from build.sbt so play will generate a static router, or (better) make your controllers classes instead of objects, and use dependency injection.
java,playframework-2.0,sbt,typesafe-activator,typesafe
Solved. I had to do a git checkout on the "project/play-fork-run.sbt" file on so it could return the line below to 2.3.8 version: addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.3.9") After that I reseted the "activator ui" command. It ran the whole upgrade to 2.3.9 again and now it worked. Probably some...
java,playframework,playframework-2.0,java-8
It is not possible right now. There is an github issue to replace F.Option with java.util.Optional. It will be delivered in Playframework 2.5.0.
routing,playframework-2.0,url-encoding
I wouldn't do it - slash has its usage even in the param, therefore it SHOULD be encoded. Also for security reasons that isn't best option. On the other hand, in Play you have other possibilities to pass the return URL, my favorite are Flash/Session scopes and/or in mem Cache...
playframework,playframework-2.0
Sure. Your best bet is to use request interceptors. This is using a request filter, lightly adapted from those docs: import play.api.Logger import play.api.mvc._ object MaintenanceModeFilter extends Filter { def apply(next: (RequestHeader) => Future[Result])(request: RequestHeader): Future[Result] = { if (/* check for trigger */) { Logger.info("Sending maintenance mode response") Ok(/*...
java,url,parameters,playframework-2.0
As you can see in Play's routing documentation you can use the colon syntax to define that some part of your route URL is a variable and pass that variable to the controller method, ie: POST /students/:studentNo controllers.Application.Post(studentNo: Long) ...
If you look at Rendering an <input> element section in the documentation, you'll find out that all helpers are placed at the views.html.helper package. Since the view you mentioned is located in the views.html package the import can be relatively shorter.
java,ajax,unit-testing,playframework,playframework-2.0
You can use a FakeRequest to be passed to a route()-call. @Test public void testResetValueWithFakeRequest() { Call call = controllers.routes.Application.resetValue(1); ImmutableMap<String, String> formData = ImmutableMap.of("username", "Jakob"); RequestBuilder request = fakeRequest(call).bodyForm(formData); Result result = route(request); assertEquals(OK, result.status()); } Please see chapters Testing your application > Unit testing controllers and Writing functional...
scala,playframework,playframework-2.0,akka
That's because some Scala libraries (including Play) have a Scala API as well as a Java one. Example: * play.api.libs.concurrent.Akka * play.libs.Akka I agree that Play's packages' names could be made clearer....
Have a look at the JavaDoc (it has an or expression as an example): // Example: Using an Expr.or() method Query<Order> query = Ebean.createQuery(Order.class); query.where( Expr.or(Expr.eq("status", Order.NEW), Expr.gt("orderDate", lastWeek)); List<Order> list = query.findList(); This perhaps makes it a bit easier to understand why this code: .or(Expr.eq("user_1", user_2_id), Expr.eq("user_2", user_1_id)) Results...
scala,playframework,playframework-2.0,sbt,assets
I found the key is to pass in another parameter to routes.Assets.at, the following is from the playframework Asset document GET /javascripts/*file Assets.at("public/javascripts", file) GET /images/*file Assets.at("public/images", file) Then you will need to specify both parameters when using the reverse router: <script src="@routes.Assets.at("public/javascripts", "jquery.js")"></script> <image src="@routes.Assets.at("public/images", "logo.png")"> ...
java,intellij-idea,playframework-2.0,playframework-2.3
Most likely it's connected with the fact that the routes object is generated during project compilation. After compilation, it should be placed under the target/scala-{ver}/src_managed directory. Mark this directory as source and IntelliJ should see routes correctly. You can use one of the following steps to do it: right-click the...
json,scala,playframework,playframework-2.0,jsonpath
You can do: val text = (json \\ "name").asOpt[String] .getOrElse((json \\ "title").as[String]) ...
java,playframework,playframework-2.0,guice,guice-3
A found a workaround. I just used an access method provided by Play framework 2.4 since it fully integrates Guice. Here is my Authentication Wrapper class: public class AuthenticatorWrapper extends Security.Authenticator { private final Security.Authenticator authenticator; public AuthenticatorWrapper() { authenticator = Play.application().injector().instanceOf(Security.Authenticator.class); } @Override public String getUsername(Http.Context ctx) { return...
playframework,playframework-2.0,playframework-2.3
Unfortunately this is a limitation of Play's Java API in Play at the moment. There is no way in the Java API to get back pressure from the client, so it's easy to overwhelm the client. This will be fixed in Play 3 when we provide a better streams API...
java,playframework-2.0,sbt,securesocial
Changed "ws.securesocial" % "securesocial" % "2.1.4" to "ws.securesocial" % "securesocial_2.11" % "3.0-M3" name := "testing" version := "0.1" lazy val `testing` = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.1" resolvers += ( Resolver.url("SecureSocial Repository", url("http://securesocial.ws/repository/snapshots/"))(Resolver.ivyStylePatterns) ) libraryDependencies ++= Seq( "ws.securesocial" % "securesocial_2.11" % "3.0-M3", "org.mongodb" % "mongo-java-driver" % "2.12.1", "org.jongo" %...
It appears that you are calling WS inside the map block of collection.insert. That map expects that you return a play.api.mvc.Result, however WS.post with the map you have attached to it, returns a Future[play.api.mvc.Result]. Given that the Future.successful(BadRequest(Json.obj("message"->"Invalid email address"))) returns Future[play.api.mvc.Result] and your collection.insert returns a Future[Future[play.api.mvc.Result]] the common,...
scala,asynchronous,playframework,playframework-2.0
The issue is with your types and that they don't match up with the required ones. .fold has to result in Future[Result] in both branches (the error and the success ones). In the successful form bind branch you have this: case (userData) => ... // The ... must evaluate to...
java,playframework,playframework-2.0
It has nothing to do with Play Framework. You want to play sound on the webpage directly from HTML (or with some Javascript). So you don't need Java for it (though your still can serve your .wav file from Play Framework as static asset). Check these links: w3schools.com/html/html5_audio.asp or stackoverflow.com/a/13402388/972676....
Changing the stack size worked for me I used this command to run the project activator run -J-Xss4M -server ...
java,playframework-2.0,promise,java-7
From play documentation: Maps this promise to a promise of type B. The function function is applied as soon as the promise is redeemed. The function: new Function<Double,Result>() { public Result apply(Double pi) { return ok("PI value computed: " + pi); } } will convert the pi value of type...
java,playframework,routes,playframework-2.0
First of all, I see absolutely no benefit from accessing vars in application.conf from the routes file. What's the difference between changing the value of a route in the routes file or .conf file. In both cases you need to change the value and restart the server for changes to...
java,scala,playframework,playframework-2.0,template-engine
If you use LinkedHashMap as the implementation of Map you may keep the order of how objects were inserted. Shouldn't matter if using Scala's or Java's implementation. This class implements mutable maps using a hashtable. The iterator and all traversal methods of this class visit elements in the order they...
As others have posted in the comments before, the type of the Map is not something which can be deserialized into Json by the framework, but you can easily get rid of the Map: scala> val s = "hello" s: String = hello scala> val list = List(1,2,3) list: List[Int]...
scala,playframework,playframework-2.0
I am not sure about solution with ActionBuilder or ActionRefiner but that may work for you: def CachedAction(key: String, time: Duration)(f: Request[AnyContent] => Result) = { Action{ request => if(cache.contains(key)){ ... } else{ ... } f(request) } } and then: def myAction(p1: String) = CachedAction("hello" + p1, 100 millis){ request...
You can set the isolation level directly on the BoneCP data source: # Set a connection's default isolation level db.default.isolation=READ_COMMITTED ...
google-api,playframework-2.0,sbt,google-api-java-client,google-api-client
Everything looks correct. I think you just need to run reload in your sbt shell to pick up the dependencies in your build.sbt. Or just re-start sbt.