Is it possible to integrate play framework 2.0 with an existing web application?

Go To StackoverFlow.com

5

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).

2012-04-04 20:32
by user1313817
Please consider reading the bounty information too - Stefan 2014-03-16 19:12


2

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

2014-03-14 20:31
by Ömer Faruk Gül
+1 for the link to the blog Let It Crash - Jus12 2014-09-22 08:07


1

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"?

2012-04-07 20:20
by adis
hi, Thank you for taking the time to answer. By integrating, I mean that they all run in the same jboss installation. I dont think I would be able to get approval for a separate play installation (by the powers to be.) I am aware of the 1.2.4 version and the war, I tried to do something similar with the 2.0, however realized that the servlet api is not supported in the 2.0 version. And I did see the ticket you have - but it mentions that the support for servlet api in the 2.1 version is also doubtful - Would you have any idea if there are any plans to support it in future versions - user1313817 2012-04-09 02:33


1

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

2014-03-18 02:30
by Rico
Thanks for your reply, but the first thing is that most apps rely on JEE services and the second thing is they cannot be refactored to fit some mvc framework - Stefan 2014-03-18 05:49
Np, you are milking that bounty aren't you - Rico 2014-03-18 06:03
What does milking a bounty mean - Stefan 2014-03-18 07:26
It means that you put a bounty on the question and that you have the power and you are using it to be very picky/selective about the several answers you are getting from SO users - Rico 2014-03-18 16:40
Indeed I need a solution, not a guess : - Stefan 2014-03-18 16:52


0

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).

  1. 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.

  2. Stopping the debugging session will not stop the server.

Workaround Scala Template with Play 2.0 RC2 and Scala IDE :

  1. run your application using ~ run to enable direct compilation on file change.

  2. This way scala templates files are auto discovered when you create new template in view and auto compiled when file change.

  3. 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.

  4. 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:

https://github.com/skyluc/SandBox/wiki/play-2.0-in-scala-ide-2.0#configuring-scala-ide-for-the-play-20-web-application

http://www.playframework.com/documentation/2.0/JavaHome

http://www.playframework.com/documentation/2.0/Samples

http://scala-ide.org/docs/tutorials/play/

http://www.playframework.com/

2014-03-19 09:56
by jmail
This is an almost 1:1 copy-and-paste from the documentation .. - Stefan 2014-03-19 10:45
@Stefoan, yes, your right i'm waste a time to search form site to post the answer here.. - jmail 2014-03-19 11:14
Ads