I'm currently exploring options for rendering or routing to static web apps stored in the Play's public folder. Here is my project structure:
myapp
+ app
+ conf
+ modules
+ public
| + webapp1
| + css
| + images
| + index.html
| + webapp2
| + css
| + images
| + index.html
+ ...
The goal is to render both webapp1 and webapp2, with each index.html file referencing the corresponding css file present in its own css folder.
I attempted to use routing and redirect in the controller to serve the static html pages like this:
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)
While the index.html files are being rendered correctly through routing, the css and images within these folders are not getting loaded properly. The relative paths used by the index.html end up calling them from the root level of localhost instead of under webapp1 or webapp2 e.g., localhost/css/css1 instead of localhost/webapp1/css/css1.
I would greatly appreciate any advice or suggestions on how to solve this issue.
Sincerely, Bill