playframework-2.2

Play 2.2 EssentialAction With Futures

£可爱£侵袭症+ 提交于 2019-12-13 07:07:14
问题 I'm trying to implement an authentication mechanism similar to this example: def HasToken(action: String => EssentialAction): EssentialAction = EssentialAction { requestHeader => val maybeToken = requestHeader.headers.get("X-SECRET-TOKEN") maybeToken map { token => action(token)(requestHeader) // apply requestHeader to EssentialAction produces the Iteratee[Array[Byte], SimpleResult] } getOrElse { Done(Unauthorized("401 No Security Token\n")) // 'Done' means the Iteratee has completed its

Can I use SecureSocial for calls from say an mobile app

做~自己de王妃 提交于 2019-12-13 00:08:12
问题 I have a play 2 application that uses SecureSocial for authentication and it works perfectly. I now want to make calls to these rest services on the play application from outside the web app. Can I for example have an android application use the same secured rest methods? 回答1: FortyTwo team have a post in their engineering blog which clearly explains the steps in a detailed example: http://eng.42go.com/mobile-auth-with-play-and-securesocial/. 来源: https://stackoverflow.com/questions/22097788

Play 2.3 subproject dependsOn

偶尔善良 提交于 2019-12-12 23:22:18
问题 This is how I configure the subprojects at Play 2.3. However, it gives me sbt.ResolveException: unresolved dependency. What is wrong with my settings? This works in 2.2. val model = Project(appName + "-model", file("models")).enablePlugins(play.PlayScala).settings( version := appVersion, libraryDependencies ++= modelDependencies ) val main = Project(appName, file(".")).enablePlugins(play.PlayScala).enablePlugins(SbtWeb).settings( version := appVersion, libraryDependencies ++= appDependencies

Lighttpd reverse proxy converts HTTP/1.1 requests to 1.0

为君一笑 提交于 2019-12-12 18:41:35
问题 I'm using lighttpd as a reverse proxy for a group of Play instances, which are on version 2.1.1 at the moment. The Play applications use chunked transfer encoding to do COMet (server push). Lighttpd version is 1.4.28 (latest supported version for Ubuntu 12.04). This setup is working nicely, but now I'm upgrading to Play Framework 2.2.1. The play framework now enforces that chunked responses must be in response to a HTTP/1.0 request (see https://github.com/playframework/playframework/commit

Can't get access to a project's classes / objects from Build.scala

倖福魔咒の 提交于 2019-12-12 18:32:58
问题 I'd like to create the task like Ruby rake. I know I can do by sbt tasks http://www.scala-sbt.org/release/docs/Detailed-Topics/Tasks But I can't use any class or object from my project. For example: # project/AppBuild.scala object AppBuild extends Build { //............ lazy val sampleTask = taskKey[Unit]("hello123", "A sample task.") := { val u = models.User.single(123) // Error! models is not accessible } } So I can't get access to models.User or any other class in my project. What can I do

PlayFramework 2.6.x - Execute Application Startup Code

≡放荡痞女 提交于 2019-12-12 18:19:27
问题 This question is with regard to play! java 2.6.x I am attempting to bootstrap some initialization code which needs to be executed during application startup As per documentation, I have a class called Module in root package public class Module extends AbstractModule { private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("application"); @Override public void configure() { logger.info("Loading Modules"); bind(ConsumerBootstrap.class).asEagerSingleton(); } } However it is

How to change value of setting for a custom configuration under play/sbt?

匆匆过客 提交于 2019-12-12 15:35:36
问题 I have a play project, and I want to add an sbt task that runs the application with a given folder available as a resource. However, I don't want that folder to be on the classpath during "normal" runs. I created a configuration, added the resources to that configuration, but when I run in that configuration, the files aren't being picked up for example, I have: val Mock = config(“mock”) extend Compile val mock = inputKey[Unit]("run in mock mode") val project = Project(“my project”, file(“src

Play Framework: Handling dynamic created files (images) in PRODUCTION mode

邮差的信 提交于 2019-12-12 10:13:09
问题 I'm trying to allow users to upload photos to the server and then view them (all users can view all photos) in production (NOT development). While in development mode everything is simple - I can upload the files to the public folder and then read then from there, in production mode I don't have access to the public folder anymore (as this approach is for static accesses and not dynamic). So, I have 2 issues: Upload: currently I can't understand how to save the uploaded photos to a specific

Play-slick with SecureSocial: Running DB IO in a separate thread pool

落爺英雄遲暮 提交于 2019-12-12 07:53:33
问题 I have a Play 2.2.1 app that uses play-slick 0.5.0.8 to persist data to a Postgresql backend and SecureSocial 2.1.2 to handle user authorisation. Since play-slick transactions are blocking, I have created a separate slick-context execution context in my /conf/application.conf file, as per the instructions found in the plugin's Wiki: play { akka { actor { slick-context = { fork-join-executor { parallelism-min = 300 parallelism-max = 300 } } } } } This allows me to create a controller Action

playframework 2.2 java: how to set language (i18n) from subdomain

假装没事ソ 提交于 2019-12-12 07:18:47
问题 How can I set the language (i18n) not only from the users browser settings but also from subdomains (which should have higher priority) in playframework 2.2 (java)? The following should work: example.com -> english or german, depending on browser settings en.example.com -> force english de.example.com -> force german The user should be able to switch between subdomains without losing the session. Because I have a lot of java controllers, it would be great if the solution works in a