playframework

Play Mailer plugin with Play 2.5

爱⌒轻易说出口 提交于 2019-12-25 09:24:55
问题 I am struggling with play mailer plugin. I found many references to configure play-mailer plugin to send email using gmail, but none worked. Here are the details - Play 2.5 Scala 2.11 mailer plugin - "com.typesafe.play" %% "play-mailer" % "5.0.0" And here is my code: application.conf: play.mailer { host="smtp.gmail.com" port=587 ssl=no tls=yes user="pariXXXXXX@gmail.com" password="XXXXXX" debug=no timeout=60 connectiontimeout=60 mock=false } Controller: class HomeController @Inject() ( val

Firebase and Java Play! Framework not fully working together

最后都变了- 提交于 2019-12-25 09:17:13
问题 I am trying to add Firebase to my Java Play! Framework project. I followed the steps here https://firebase.google.com/docs/admin/setup. There is very little documentation on the server setup. Lots on android, but it is not too helpful. The Problem I am able to initialize the firebase library and even get the first call to the database to return successfully, but after that all of the next calls just hang. They never return in ether the onCancelled or onDataChange blocks. I don't get any

Deadbolt play java Change password the first time login

不打扰是莪最后的温柔 提交于 2019-12-25 09:16:16
问题 I have 4 group: admin, service, user, guest, admin is created in database, the first time admin login required change password, I want to redirect to form change password and only admin need that, I set redirect in onAuthFailure, but service, user, guest that not authentication in some action and redirect change password form, have a good idea, please tell me, what should I do for every role redirect an other link? , I just read document about deadbolt in 2 day, can I don't understand more,

playframework scala Seq[Future[Model]] removing the Future

醉酒当歌 提交于 2019-12-25 08:58:19
问题 I have the following issue, I have a Seq[Future[ProcessStepTemplatesModel]] and I want to remove the inner Future. What I excpected to get is a Seq[ProcessStepTemplatesModel] . The complete code looks like this Future.sequence { processSteps.map { step => // This is a "for each" over a Seq[ProcessStepTemplatesModel] val prerequisiteFuture = processStepPrerequisitesDTO.getProcessStepPrerequisiteProcessTemplateIds(step.id.get) prerequisiteFuture.map(prereqTemplates => { processTemplateDTO

Playframework and Twitter Streaming API

*爱你&永不变心* 提交于 2019-12-25 08:57:22
问题 How to read response data from Twitter Streaming API - POST statuses/filter ? I have established connection and I receive 200 status code, but I don't know how to read tweets. I just want to println tweets as they coming. ws.url(url) .sign(OAuthCalculator(consumerKey, requestToken)) .withMethod("POST") .stream() .map { response => if(response.headers.status == 200) println(response.body) } EDIT: I found this solution ws.url(url) .sign(OAuthCalculator(consumerKey, requestToken)) .withMethod(

Play 2.5 with mailer plugin

僤鯓⒐⒋嵵緔 提交于 2019-12-25 08:36:31
问题 I am using below config to send email through play app: smtp.mock=false smtp { host="smtp.mail.yahoo.com" port="465" ssl=true user="pari.test@yahoo.com" password="XXXXXXXXXXX" from="pari.test@yahoo.com" } Code works all good. However, I am getting warning: smtp is deprecated, use play.mailer instead. When I use play.mailer configs code fails. config play.mailer { host="smtp.mail.yahoo.com" port=465 ssl=yes tls=no user="pari.test@yahoo.com" password="XXXXXX" debug=no timeout=60

Play Framework 2.2 : Error: This exception has been logged with id

谁都会走 提交于 2019-12-25 07:58:50
问题 I am completed building a website in Play framework. The website is deployed at server. But, I am facing some random occurring issue like this one.. This exception has been logged with id 6ilmmm0fk. I got the same error previously as well. So, I restarted the complete application and it was gone. But, again I am facing the same error. Why is this error occurring? I got the stack trace that looks like this play.api.Application$$anon$1: Execution exception[[SQLException: Timed out waiting for a

findAll fails after play morphia is reinitialised

放肆的年华 提交于 2019-12-25 07:49:24
问题 I have the following class which is persisted into a mongodb using morphia in a play! application. The class resides in a module which is a dependency of another play! application. Its configuration is read from a file and persisted into the db on initial load (if its not already in the db) and then subsequent requests use the db version. @Entity public class Page extends Model { @Id public Long navigationId; // etc ... } The initial load and subsequent query access works ok and i can see the

Java validation from list

南笙酒味 提交于 2019-12-25 07:39:22
问题 If I have a class and I want to check if the input to a property in that class is in a list, how would I do this? Example public class Length { public static final List<String> ALLOWABLE_UNITS = Collections.unmodifiableList(Arrays.asList("inches", "feet", "meters", "millimeters")); public BigDecimal lengthValue; @SomeMatchingAnnotation(ALLOWABLE_UNITS) public String lengthUnit; } Is there an annotation to do that? Would I have to create my own? 回答1: In the setter for your field you could do

calling methods of Controller from scala companion objects

淺唱寂寞╮ 提交于 2019-12-25 07:15:12
问题 I have a controller in my project which has a socket method I want to call that method in companion object.But somehow i am not able to do that as i need to pass parameters also to companion object , which i can't . Here's my code sample: class WebSocketController @Inject() (cache:CacheApi)(implicit actorSystem:ActorSystem, materializer:Materializer) extends Controller { def socket = WebSocket.accept[JsValue , JsValue] { request => ActorFlow.actorRef(out => SocketHandlerClass.props(out