Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a GWT application (including Applets) inside an IFRAME from an ASP.NET 3.5 app?

We are looking at integrating a full-blown GWT (Google Web Toolkit 2.0) application with an existing ASP.NET 3.5 application. My first gut reaction is that this is a horrible frankenstein idea. However, the customer has insisted that we use this application developed by a third-party.

I have almost NO CONTROL over the development of the GWT app.

My first thought is to actually attempt to embed this in an iFrame. Because GWT is running under Tomcat/Jakarta, it is hosted on a different server from the .NET app so the iFrame src will be to a URL on the other machine.

I need to utilize our own ASP.NET authorization scheme to restrict access to the embedded GWT application. The GWT app also uses embedded java applets, which don't seem to be working right now inside the iframe. The GWT app makes calls to a backend server (using GWT-RPC?).

Any major problems with this approach that anyone can see? Will GWT work on an iframe while hosted on a different machine?

NOTE: SIMPLY ADDING A DIV WITH THE SAME NAME DOES NOT WORK FOR THIS!

like image 203
Jay Stevens Avatar asked Feb 12 '10 17:02

Jay Stevens


2 Answers

To expound on what Tony said, GWT can live on any page. At its lowest level, GWT hooks into a div by its ID or the body element, as its RootPanel, and adds widgets to it from there.

Simply add a div to your ASP page like <div id="gwt-root" /> and in your GWT code, start with RootPanel root = RootPanel.get("gwt-root"). Then you can start adding widgets to that panel to build the GWT portion of your page.

You'll also need to bring in your GWT generated code with a script tag, like so:

<script type="text/javascript" src="gwt-app-name/gwt-app-name.nocache.js">

Also, if you want, GWT can interact with the rest of the page using regular JavaScript using JSNI.

like image 165
Jason Hall Avatar answered Oct 05 '22 02:10

Jason Hall


you do not need an IFRAME. Writeyour application so that the main panel is hosted inside a div with a specific id. If your ASP.net can provide a div with the same id, then all you have to do is include the generated JavaScript files (+ some style sheets) and your application will display inside the div.

like image 37
Tony BenBrahim Avatar answered Oct 05 '22 04:10

Tony BenBrahim