We have a large existing java web application to which I would like to add the play framework - Is this possible, and if so, are there any pointers to how to do this?
The application is a portal application that we are looking to migrate to jboss -- and we would be adding a portal(liferay or gatein) on the jboss application server(so play would need to 'play' with all of the above).
In case of your portal project Play Framework can help you as a backend service to aggregate data or to handle some distributed and computational tasks for your portal.
Play Framework is very powerful with Akka (http://akka.io). Akka can help you handle the complicated computations or tasks in a very easy and manageable way. As an example if your portal connects to multiple third party web services to fetch data for your users, Play, with Akka can handle this very well. With Akka actors, you can fetch the data simultaneously from the third party web services and in return, merge these data and serve to your portal with a single call.
To put simply, you can let Play and Akka do what they are good at and isolate your portal from doing tasks which are not actually about your business logic.
There is this blog called Let It Crash (http://letitcrash.com) which has some very good scenarios on how to use Akka.
Some posts may give your more ideas how you can integrate with your platform:
http://letitcrash.com/post/66094078446/presentation-scaling-out-with-akka-actors
http://letitcrash.com/post/30509298968/case-study-an-auto-updating-cache-using-actors
With play 1.2.4 you can make a .WAR file and place this .war file in the deploy folder of JBOSS. But the new version (2.0) does not support .war files yet: https://play.lighthouseapp.com/projects/82401/tickets/8-war-packaging
So the only option is to place it outside the JBoss folder and run it as standalone. Then you integrate the URL of your play application somewhere on the portal. Is this what you mean by "integrating"?
Well, you can't put a play
container in a JBOSS
container but you can actually put the Java code that you have in your JBOSS
container in a play
container. You would have to create the routes and controllers for your JBOSS
java code, and put the java code under the app
directory. Then, simply compile it in play.
Finally, you can distribute your standalone container using the play dist
command.
http://www.playframework.com/documentation/2.2.x/ProductionDist
Play Framework makes it easy to build web applications:
Play provides a command to simplify Eclipse configuration. To transform a Play application into a working Eclipse project, use the eclipsify command:
[My first application] $ eclipsify
You then need to import the application into your Workspace with the File/Import/General/Existing project
… menu (compile your project first).
You can also start your application with play debug run and then you can use the Connect JPDA launcher using Debug As to start a debugging session at any time.
Stopping the debugging session will not stop the server.
Workaround Scala Template with Play 2.0 RC2 and Scala IDE :
run your application using ~ run to enable direct compilation on file change.
This way scala templates files are auto discovered when you create new template in view and auto compiled when file change.
If you use normal run then you have to hit Refresh on you browser each time. Play team will check this issue with Scala IDE team.
If you make any important changes to your application, such as
changing the classpath, use eclipsify
again to regenerate the
configuration files.
Tip: Do not commit Eclipse configuration files when you work in a team!
The generated configuration files contain absolute references to your framework installation. These are specific to your own installation. When you work in a team, each developer must keep his Eclipse configuration files private.source:
http://www.playframework.com/documentation/2.0/JavaHome
http://www.playframework.com/documentation/2.0/Samples
http://scala-ide.org/docs/tutorials/play/