playframework-2.1

Overriding Play 2.1 Checkbox Form Helper for Twitter Bootstrap

混江龙づ霸主 提交于 2019-12-06 02:58:34
I want to show an HTML checkbox followed by the label to the right. I followed Pere Villega's suggestion , and modified the Play 2.1-SNAPSHOT version of views.helper.checkbox.scala as views.helper.twitterCheckbox.scala . My project uses the version of Twitter Bootstrap provided by Webjars : @** * Generate an HTML input checkbox for Twitter Bootstrap. * * Example: * {{{ * @checkbox(field = myForm("done")) * }}} * * @param field The form field. * @param args Set of extra HTML attributes ('''id''' and '''label''' are 2 special arguments). * @param handler The field constructor. *@ @(field: play

How to debug play framework 2.1.0 scala tests in intellij

别来无恙 提交于 2019-12-06 02:56:27
问题 i try to debug some tests with intellij. I have configurated the remote debug as explain in : How to make the debugging in playframework in IntelliJ Idea And can debug controllers and stuff. When I try to debug tests such as explain in: Is it possible to debug Play! tests from IntelliJ, with a moduled that is located in a sub-folder? But i recibe the next message: Action not found For request 'GET /@tests' These routes have been tried, in this order: 1GET/controllers.Application.index 2GET

Play Framework Dependency Injection

旧巷老猫 提交于 2019-12-06 02:36:18
I've been looking all over Google to find some useful information on how to use Guice/Spring DI in Play Framework 2.1 What I want to do is to Inject several Services in some DAO's and vice versa. Just need some clarification on this - With play 2.1, do you have to use an @ annotation within the routes file for DI? I've looked at this guide here - https://github.com/playframework/Play20/blob/master/documentation/manual/javaGuide/main/inject/JavaInjection.md and applied the following steps creating a Global class in app and adding the GUICE dependencies in Build.scala but keep on getting a null

Can I access Http.Context.current() from an arbitrary asynchronous task?

≡放荡痞女 提交于 2019-12-06 02:12:11
问题 I'm working on the backend for a mobile app, which is currently running on Play 2.1.1. As part of processing some requests, we send push notifications. The downstream request to send the push notification should be entirely asynchronous and decoupled from the originating request-response for the mobile client. I want to have access to the Http.Context.current() while sending the downstream request in order to access some tracing information that we pass in request headers. Originally, the

integration of sbt (play!) project with maven parent pom

我们两清 提交于 2019-12-05 23:16:42
问题 I have a maven project with multiple maven modules organized around parent pom. All these modules are packaged into JAR files which are dependencies of my Play! application built as a SBT project: MyProject -> pom.xml (parent) MavenModule1 -> pom.xml (child pom) MavenModule2 -> pom.xml (child pom) PlayApplication -> Build.scala (SBT project) Since all maven modules are child projects of parent module (MyProject), I can go to 'MyProject', execute mvn clean install and entire project, except

How to upload Multiple files using play framework?

戏子无情 提交于 2019-12-05 22:43:04
问题 i am using play framework 2.1.2 using java and i am creating view to upload multiple files and my code is here : @form(action = routes.upload.up, 'enctype -> "multipart/form-data") { <input type="file" name="picture" accept="application/pdf" multiple="multiple"><br/> <input type="submit" value="upload"> } i want to upload only doc and pdf file . how to restrict form to upload only doc and pdf file ? i can this with java but i am looking for html code. after this i want to store multiple file

Playframework 2.1 doesn't find javax.persistence and play.db

别来无恙 提交于 2019-12-05 19:28:52
问题 I have a problem with the Scala tutorial for creating an Entity with the play framework (Version 2.1). I'm trying to do: import java.util._ import javax.persistence._ import play.db.jpa._ But when I compile it tells me that javax.persistence dosen't exist and play.db neither. I suppose it's a problem of version because it seems to me that the actual yabe-tutorial is a bit old. Do you know any website who has good explanations and examples? Thanks for your help! 回答1: As you use Scala you could

Auto-reloading with Play framework on a network filesystem

折月煮酒 提交于 2019-12-05 18:51:22
I'm running a Play framework application on a VirtualBox VM with the project source code in a directory shared from the host system. The auto-reload functionality of the framework doesn't work. This is (probably) caused by JNotify being unable to detect the changes to the source files, as the filesystem is not local. Both NFS and vboxsf suffer from the same issue. Is there any way around this? Play framework has a built-in fallback mechanism for detecting changes on systems where JNotify is not available. Is it possible to force select the fallback mechanism somehow? (The performance hit would

Play Json: Transforming a Reads[T] to Reads[Seq[T]] without implicits

余生长醉 提交于 2019-12-05 16:50:47
问题 I hava a Reads[T] . I would like to parse a Json object which is expected to be an array of T 's. Is there a simple way to obtain a Reads[Seq[T]] without defining my Reads[T] as implicit? Essentially, I am looking for a function that takes Reads[T] and returns Reads[Seq[T]] . I came across Reads.TraversableReads , and thought that I can pass the implicit reader it needs explicitly, but this function also wants a CanBuildForm[...] , which does not sound like fun. 回答1: There is a method for

How do I ignore ssl validation in play framework scala ws calls

萝らか妹 提交于 2019-12-05 15:56:34
I want to consume a web service that is using an invalid certificate (self signed) I want to make the web service call without performing any sort of certificate validation. How do I do it? In your application.conf add the below line ws.acceptAnyCertificate=true By the way, if you going to user play2 as a lib, to allow self-signed ssl certificates you should do the following(2.1.3 as actual version): create conf/application.conf with at least one string ws.acceptAnyCertificate=true create new application val app = new play.api.DefaultApplication(new File("."), this.getClass.getClassLoader(),