I've developed a pretty extensive rest API using restlet, but now I need to serve web pages. I've looking into the play framework and it seems like a pretty good solution to my problem. There's a lot of code to share so I'd like to have both running from the same server/jvm (for eventual deployment on Heroku.
Is it possible to configure the application server, like jetty, to split the calls up based on URL path to go to either restlet or play? If so how? Do I start with a play project or a restlet project, and how do I modify it?
thanks!
There are several options here
You could use a fronted Apache layer, so that you can completely separate the Restlet part from your Play part. As you are deploying to Heroku though, I am not sure if you will be able to do this as Heroku doesn't give you a fronted http layer
Modify the HTTP handler. This would involve creating your own module or modifying the core source of Play. This certainly would solve your use case, but I don't think modifying core is a great answer, and the module approach is quite overkill.
Using Play 1.x you could have a single controller action for all your Restlet API that simply calls your Restlet services. In Play 2.x you can use the Global object onRouteRequest method.
If you are thinking of deploying to a PaaS like Heroku, I think I would go with option 3.