views:

909

answers:

2

Is it possible to create widgets / portlets in GWT that can be dynamically loaded and added to a GWT web application, and where the GWT widgets can reside in a separate war files?

To clarify my question: JSR168/JSR286 compliant portals make it possible to create portlets in separate projects (war files) and to dynamically load these into a portal page. Suppose you want to do something similar in a GWT application. So suppose we made a portal using only GWT for the GUI (no JSP or alike) and we want to dynamically add a "portlet" written in pure GWT. Would that be possible?

I can imagine that it could be done using an IFrame, but it would be nicer if such a GWT widget/portlet would be fully part of the GWT host "portal" application and share it's style sheets and other resources.

+1  A: 

I'd imagine that a "GWT portlet" is nothing more than a widget that you write yourself (and perhaps implements a common interface).

The hard part is to dynamically allow a precompiled gwt app to include another gwt component (the portlet in this case) without compiling again with the source (which is what the question seems to imply).

Chii
Thanks. That last part "dynamically include" is exactly what I want. Suppose you got a web app that fits 80% of the needs of its users, but 20% of the users have special needs. Then it would be nice to dynamically include customized components for them only.
Roy
that, at the moment, cannot be done (at least, not to my knowledge - i'd love to be corrected!). GWT is a compile time thing, where you will need to have the source code for the entire GWT module and dependencies for the compilation to work.what you want is, i assume, to allow a user to upload a plugin/something and have that become part of the app. It isnt impossible to do it, just takes a lot of work, and you wont really be taking advantage of GWT at all (essentially, you'd be writing a "portlet" container yourself).
Chii
A: 

I too have been looking into this, especially after seeing the Wave demo. From what I can tell, the approach the wave team have taken is to use either the Google Gadget api or a variation of the Gadget api. Google also have a tutorial on writing a gadget in GWT. I would image you would use a event based api where JSO objects are passed between the Gadget and the GWT application. Note that this may also introduce XSS issues if from different domains. I think of this as akin toloading a swf dynamically in flash. The event method is similar to working safely with cross-site dynamic loaded swf's.

nso1