gwtgwtpgwt-platform

Multiple entry points in GWTP


GWTP uses Formfactors to support multiple targets like;

Next to multiple targets, i want to support multiple Desktop versions of my project by means of different domains or addresses.

This means multiple entry points connected to different URL's

Or

How do i configure multiple entry points to different URL's (or addresses) in GWTP?


Solution

  • During a nice chat at https://gitter.im/gwtproject/gwt# some really nice ideas where suggested;

    The basic idea is to just check the URL and then start a different root panel (desktop or dashboard). One step further this different desktop/dashboard implementations can be achieved with multiple modules (with different URL's) in the project (like the tbroyer archetype) enabling the possibility to use modules with shared functionality.

    Another approach would be to decide which permutation to provide after checking the URL. This would just be a variation on the current GWTP formfactors implementation;

    https://github.com/ArcBees/GWTP/blob/master/gwtp-core/gwtp-mvp-client/src/main/resources/com/gwtplatform/mvp/FormFactor.gwt.xml

    Shows how GWTP defines their property to control different formfactors the class in the "property-provider" tag will generate the JS that actually selects a value (i.e. how does the .nocache.js know which device it is running on).

    https://github.com/ArcBees/GWTP/blob/master/gwtp-core/gwtp-mvp-client/src/main/resources/com/gwtplatform/mvp/rebind/linker/formFactor.js

    Is the guts of it, supporting both a "if it matches these browsers, we are mobile" sort of thing, plus also the ability to override it from the URL and specify which should be used, for debugging and such (or "request desktop site")

    Colin Alworth

    Instead of using logic to figure out which kind of browser is running, just check window.location.hostname etc. to see if it contains desktop vs dashboard