Friday, September 14, 2018

Re: Deferred Binding - Help!


On Friday, September 14, 2018 at 3:10:03 PM UTC+2, Matthew Bergshoeff wrote:
 Hi Everyone - I've been searching everywhere for a solution to this and haven't been able to resolve it. I don't think I've properly wrapped my head around the issue, so hoping someone could provide some guidance.

I am trying to build a modular GWT application - by that I mean that there will be the core application, but it should support the addition of gwt modules ("plugins") without having to rebuild. This is being accomplished by updating parameters in the web.xml so that I can just stop the webapp, add a .jar file to the /lib directory, define the new .jar in the web.xml and restart the application. So far so good. The problem arises when trying to initialize/access the classes within the plugins.

Let's imagine I had a PetStore application (classic example!). I have an interface called Pet that is implemented by some classic examples (Cat, Dog, Fish) in the core application. However, I want to be able to add a plugin for an exotic pet (Borneo Pygmy Elephant), and have the application (client-side) be able to load the class when a record comes up that refers to it. I am able to do this server-side using a URLClassLoader, but can't figure out how to use a Generator to instantiate all possible Pet implementations within a module.

If I am going to implement a generator, should it be in the plugin or in the core application? I've found a few examples, but none seem to pinpoint exactly what I'm trying to do. Appreciate any help...

What you're doing is put several totally distinct apps on a single page, and making them talk to each other.
Because they are totally distinct apps, their "initially-Java classes" are produced as different JS objects, obfuscated separately, etc.

Solutions:
 * think in terms of JS, not Java, and make the apps actually talk to each other (e.g. plugin "registers" into core); use JsInterop.
 * make a single app with GWT.runAsync() to split the payload, and configuration to enable/disable some code branches such that some GWT.runAsync() are never reached.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment