I am creating a web application that will have 2 view modes. One mode is just normal web site. The other view mode will be as a facebook app. In facebook, an app is shown in an iframe. In my app, I must be able to detect if the view is in facebook mode or standalone mode. I need to detect this because in facebook the screen is smaller (760px) so I need to select different CSS files but I also might change certain link targets, the general layout or certain controller behaviour. I want to deploy the whole application on one single server. I don't want to partition the application early. I do know how to separate both views physically on different nodes, i.e., by applying different application.conf files with a static parameter in it if this server is in facebook mode or not. The physical separation would mean 2 different configurations to test, with 2 different deployments, and I want to avoid that. So I am looking for a more "logical" separation.
I have the following ideas:
1.) adding a parameter to every request "GET /...?facebook=1" and extract that in a @Before method
the downside here is that I have to add the parameter to all subsequent links manually => tiresome and error prone
or is there a way to kind of "hack" the Router to do that when generating reverse routings?
2.) prefix the path with some context "GET /fb/..." and check it's presence in a @Before action
the downside here is that I will need to duplicate the routes and the show stopper seems to be that the reverse routing is ambiguous and I do not see a way to tell the router which route I want
again, is the a way to kind of hack into the Router to add the prefix on reverse routes?
3.) < your suggestion here, please ;) >