I am trying to figure out a way to render or route to some static web apps hosted in the Play's public folder. My project structure is listed as following:
myapp
+ app
+ conf
+ modules
+ public
| + webapp1
| + css
| + images
| + index.html
| + webapp2
| + css
| + images
| + index.html
+ ...
I would like to render webapp1 and webapp2. The index.html in each web app would use the css file in the css folder in each web app.
I tried to use routing like this and use redirect in the controller to render the static html page:
Redirect("/webapp1/").withCookies(Cookie("token", "")).bakeCookies()
Redirect("/webapp2/").withCookies(Cookie("token", "")).bakeCookies()
GET /webapp1/ controllers.Assets.at(path="/public/webapp1", file="index.html")
GET /webapp1/*file controllers.Assets.at(path="/public/webapp1", file)
GET /webapp2/ controllers.Assets.at(path="/public/webapp2", file="index.html")
GET /webapp2/*file controllers.Assets.at(path="/public/webapp2", file)
The index.html will be routed and rendered correctly. However, the css and the images in the folders were not loaded correctly. The index.html loads them using relative path. The css and images then somehow is loaded at top level such as localhost/css/css1, instead of localhost/webapp1/css/css1.
Advices would be highly appreciated.
Bill