[Engine-devel] Dynamic resource loading in GWT

Tomas Jelinek tjelinek at redhat.com
Wed Aug 7 12:10:43 UTC 2013


Hey Roy,

well, I'm not a fan of using the dictionary - it is an associative array and opens a door to
mistakes which will not be handled by compiler like locales.get("naem") will not return me the name :)
At least not for data we know how will look like (e.g. for the os info)

We already embed some info into the host page and use it on the client using JavaScript Overlay Types [4]. 

You can have a look for example at GwtDynamicHostPageServlet:
request.setAttribute(MD5Attributes.ATTR_USER_INFO.getKey(), getUserInfoObject(loggedInUser));
and on the FE side the overlay type is: AutoLoginData

But I would be careful how much info do we want to embed into the host page - it can make it significantly big
and influence the performance (for example we are using code splitting [5] to download only the parts of the app
we actually need when we need them). To embed too much info which is not always needed is a step to the opposite 
direction. I don't say it is wrong, it just has to be considered.

Tomas

[4]: http://googlewebtoolkit.blogspot.cz/2008/08/getting-to-really-know-gwt-part-2.html
[5]: http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html

----- Original Message -----
> From: "Einav Cohen" <ecohen at redhat.com>
> To: "Roy Golan" <rgolan at redhat.com>
> Cc: "engine-devel" <engine-devel at ovirt.org>
> Sent: Wednesday, August 7, 2013 1:08:58 PM
> Subject: Re: [Engine-devel] Dynamic resource loading in GWT
> 
> Hi Roy,
> 
> a couple of notes (I could be totally wrong here, GWT experts - please
> review/comment):
> 
> - from [1]:
> "Provides dynamic string lookup of key/value string pairs defined in a
> module's host HTML page" -
> there is a chance that a gwt dictionary is limited to reading key/value
> string pairs that reside
> within the *gwt module host HTML page* (i.e., within the context of the GWT
> application -
> "http://[server]/webadmin/webadmin/...") and not outside - need to find that
> out.
> 
> - again, from [1]:
> "a variety of error conditions (particularly those involving key mismatches)
> cannot be caught until
> runtime. Similarly, the GWT compiler is unable discard unused dictionary
> values since the structure
> cannot be statically analyzed".
> (this is expected, as the suggested loading here is dynamic, rather than
> static)
> 
> - not sure exactly how this would work with localization; there is "A Caveat
> Regarding Locale"
> mentioned in [1] - IIUC, we will lose the automatic locale-mapping that we
> have today, and we would
> need to do it ourselves somehow (not a big deal, I suppose, just some extra
> work that needs to be
> done here).
> 
> ----
> Thanks,
> Einav
> 
> [1]
> http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/Dictionary.html
> 
> ----- Original Message -----
> > From: "Roy Golan" <rgolan at redhat.com>
> > To: "engine-devel" <engine-devel at ovirt.org>
> > Sent: Wednesday, August 7, 2013 2:59:07 AM
> > Subject: [Engine-devel] Dynamic resource loading in GWT
> > 
> > Painful issue here - we all know the regular drill of maintaining
> > messages in many places, I18N files and so on.
> > Also there's a patch to make all available timezone an java enum and by
> > that share it for free with the UI. its a way better than a backend Query.
> > 
> > But this is all hard-coded, not flexible, hard to maintain, we all know.
> > 
> > Why won't we make GWT load a javascript dictionary/dictionaries from a
> > servlet or our host page html[1] using GWT Dictionary[3]?
> > 
> > that way the configuration is shared with the engine, it relies on the
> > disk, customers and GSS can change it on-site and so on.
> > 
> > 
> > | index.html | -> | file servlet | -> |read /etc/ovirt-engine/conf/...|
> > 
> >      ^
> >       |
> > 
> > | GWT loads Dictionary |
> > 
> > 
> > candidates for dynamic resources
> > * I18N resources AppErrors...
> > * config ( just the UI subset )
> > * osinfo ?
> > 
> > 
> > 
> > [1] host page html -
> > http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideHostPage
> > [2] Dynamic string internationalisation -
> > http://www.gwtproject.org/doc/latest/DevGuideI18n.html#DevGuideDynamicStringInternationalization
> > [3]
> > http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/Dictionary.html
> > 
> > Thanks,
> > Roy
> > _______________________________________________
> > Engine-devel mailing list
> > Engine-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/engine-devel
> > 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 



More information about the Devel mailing list