How to Embed a RAP Application in a Web Page

How to Embed a RAP Application in a Web Page

A slightly overlooked aspect of RAP Applications is that they do *not* have to take the whole page in your browser. Instead they can also be embedded into an existing web page. The example below is embedded into this blog post and is fully usable. My pet-term for such an application is “RAPplet” – kinda like an applet but without the need for a JVM in the browser.

A straightforward iframe element will do the trick, as shown in the snippet below:
<iframe src="https://rap.eclipse.org/maildemo/rap?startup=maildemo" name="maildemo" width="675" height="300" frameborder="0">Sorry your browser does not support iframes.</iframe>

Happy hacking,
Elias.

9 Comments
  • Chris Aniszczyk (zx)
    Posted at 03:45, 2007-11-20

    Cool!!!

  • AlBlue
    Posted at 13:53, 2007-11-20

    Shows up as a Server Error 500 and a NullPointerException for me.

  • Chris Aniszczyk (zx)
    Posted at 15:16, 2007-11-20

    Is the source of this example available anywhere?

  • GrimTim
    Posted at 15:41, 2007-11-20

    I get:

    java.lang.NullPointerException
    org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter.closeElementIfStarted(HtmlResponseWriter.java:689)
    org.eclipse.rwt.internal.lifecycle.HtmlResponseWriter.startElement(HtmlResponseWriter.java:489)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandlerSync.sendMultipleClientsPerSessionPage(RWTLifeCycleServiceHandlerSync.java:163)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandlerSync.serviceInternal(RWTLifeCycleServiceHandlerSync.java:75)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandlerSync.access$0(RWTLifeCycleServiceHandlerSync.java:48)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleServiceHandlerSync$1.service(RWTLifeCycleServiceHandlerSync.java:43)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleBlockControl$ServiceHandlerProcessor.run(RWTLifeCycleBlockControl.java:68)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$PoolRunnable.run(RWTLifeCycleThreadPool.java:38)
    org.eclipse.rwt.internal.lifecycle.RWTLifeCycleThreadPool$PoolWorker.run(RWTLifeCycleThreadPool.java:66)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

  • Elias Volanakis
    Posted at 18:34, 2007-11-20

    @Chris: the source is not available yet. I will do a posting about .war deployment and include the source there. If you want it earlier I can send it by email. It’s tiny anyway (3 classes).

    @alblue, grimtim: hmm, try reload :). The weird thing about the full stacktrace is that none of my code is on it. I’ll have a look at this though. Did you do something specific that could help me reproduce it?

    Regards,
    Elias.

  • Willian Mitsuda
    Posted at 21:03, 2007-11-20

    Cool, but a little slow. Does it take a roundtrip to the server every time a button is pressed?

  • Elias Volanakis
    Posted at 22:51, 2007-11-20

    @alblue, grimtim: the NullPointerException in HtmlResponseWriter was a RAP-bug that has been fixed in the meantime. I’m deploying a new version that has been compiled against RAP HEAD instead of RAP 1.0.

    @willian: yes, currently each click causes a round trip.

    Regards,
    Elias.

    PS: The calculator will be offline for the next 10 minutes or so…

  • Anonymous
    Posted at 12:42, 2008-04-07

    “PS: The calculator will be offline for the next 10 minutes or so…”

    Maybe you meant the next 10 months? 🙂

  • Elias Volanakis
    Posted at 18:43, 2008-04-07

    Hi anonymous,

    the RAP calculator is currently offline.

    I need a new server for hosting it. I’ll post a comment once i’ve found a new home for it.

    Regards,
    Elias.