playframework-2.2

Is there a nice Play2 way of injecting instances in Play Plugins with Guice

被刻印的时光 ゝ 提交于 2019-12-23 13:07:25
问题 I'm trying to figure out how to inject my classes with Google Guice into a play.api.Plugin. I have implemented Guice to work with my controllers and it works great. I use: "com.google.inject" % "guice" % "4.0-beta", "com.tzavellas" % "sse-guice" % "0.7.1" When a Controller instance is needed the getControllerInstance method in Global will load the appropriate implementation thanks to the injector. Global: object Global extends GlobalSettings { /** * Currently we only want to load a different

Play Framework 2.2.1 - Case insensitive routing

我与影子孤独终老i 提交于 2019-12-23 09:37:53
问题 I am novice to the Play and currently working Play 2.2.1 I am trying to acheive case insensitive routing for my endpoints which are defined in "routes" e.g. I have define an route say /accessLicense in routes file, it would look like below GET /accessLicense controller.MyController.accessLicense() Now, if I fire /accessLicense it woks great; as expected, but if try to fir /AccessLicense, /AcCeSSLicenSe or any other combination of upper/lower case letter which spell exact same word, it doesn't

Play 2.2 application crashes on Heroku

我与影子孤独终老i 提交于 2019-12-23 07:47:12
问题 After moving from Play 2.0.4 to Play 2.2.0 I get this error when deploying on Heroku: Oct 15 13:23:12 heroku/web.1: Starting process with command `target/universal/stage/bin/demagog -Dhttp.port=${PORT} ${JAVA_OPTS} -Dconfig.resource=${DEMAGOG_ENVIRONMENT}.conf` Oct 15 13:23:13 app/web.1: Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true Oct 15 13:23:13 app/web.1: Bad application path: -Xmx384m Oct 15 13:23:15 heroku/web.1: State changed from

Use of BeanPersistAdapter in a Plugin

ぐ巨炮叔叔 提交于 2019-12-23 05:47:11
问题 In order to perform pre/post insert/update/delete actions ( isRegisterFor(Class<?> clazz) , postInsert(BeanPersistRequest<?> request) , ... ) with Ebean in Play, I implemented a class IndexAdapter extends BeanPersistAdapter . Works - app -- models --- Car --- Person --- House --- IndexAdapter -- controllers --- ... Everything went well until I decided to transform it (it's more than one class actually) into a Play plugin. Doesn't work - app -- plugin --- IndexAdapter -- models --- Car ---

PlayFramework how to access routes in view from other submodule view

試著忘記壹切 提交于 2019-12-23 02:40:33
问题 I am writting application in Play Framework using submodules: common shopping ctd I would like to have in my view link to view from other module. /modules/common/app/views/choose.scala.html: @main() { <a href="@controllers.common.routes.Index.index">common module</a> <a href="@controllers.shopping.routes.Index.index">shopping module</a> } That code gives me an error: Compilation error object shopping is not a member of package controllers <a href="@controllers.shopping.routes.Index.index">

Purely Dynamic forms using play framework

隐身守侯 提交于 2019-12-22 19:47:29
问题 I have a Play 2.2 application which gets, thru an external web service, a JSON with field name, type and constraints info ; the content of this JSON can be different every time (though the overall structure stays same, with just the difference in number of fields etc.). Now the requirement is to render a HTML form based on the field definition received. Can someone advise what would be the best way to do this (I don't think the usual play-forms can be very useful here, unless someone can tell

playframework setting custom message for @Required field globally

白昼怎懂夜的黑 提交于 2019-12-22 06:36:58
问题 I am looking for help with translating Validation messeges in Play framework 2.2 I have fields that are required: f.e. @Required(message = "To pole jest wymagane") public String miesiac; @Required public String miejsce; @Required public String oddzial; But I would to have this message: "To pole jest wymagane" globally. How can I achive it? Should I use conf/messagess.pl file for translation To polish language. Please give me some help 回答1: Yes, you should use the conf/messages file for your

Play Framework: Redirect to controller method with arguments

ぐ巨炮叔叔 提交于 2019-12-22 05:33:48
问题 I am building a web application with PLAY framework 2.2.1 and am trying to display all available http get query parameters for the requested site in the address bar, even the ones that are not set in the request. In cases where not all http get parameters are set, I want to add the unset parameters with the default values and make a redirect. I have a site that can be requested with GET: GET /test controllers.Application.test(q:String, w:String ?= null, f:String ?= null, o:String ?= null)

Custom bridge table in playframework ebean

不羁岁月 提交于 2019-12-22 01:48:17
问题 I am unsuccessfuly trying to create bridge table that would resolve two @ManyToMany relations. However this table have to contain additional field. For example: Course: -course_id - pk Student: -student_id -pk Bridge: -(course_id, student_id) - pk -additional_field My student class looks like this: @Entity public class Student extends Model { @Id @OneToMany public List<Bridge> student_id; } Course class is basicaly the same. Bridge table looks like this: @Entity public class Bridge extends

compose slick dbaction with authenticated action

有些话、适合烂在心里 提交于 2019-12-21 21:49:36
问题 I have my custom authenticated action that is like def Authenticated(rights: String*) = new ActionBuilder[MyAuthenticatedRequest] { *** } In my controller I use this action to check the user has the right to view the page def password = Authenticated(UserRights.USER) { implicit request: MyAuthenticatedRequest[_] => Users.findById(request.account.id) match { case Some(user) => Ok(views.html.settings.password(frontUser, user)) case _ => NotFound } } My oject Users uses slick to retrieve the