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.

 

Note: if you do not see a rap application above this text, your xml-based feed reader has swallowed the example :-o. Visit the current post with your browser!

Embedding a RAP Application in a Web Page

A straightforward iframe element will do the trick, as shown in the snippet below:

<iframe
  src="http://rap.eclipse.org/maildemo/rap?startup=maildemo" width="675" height="300" frameborder="0" name="maildemo">
<p>Sorry your browser does not support iframes.</p>
</iframe>

Happy hacking,
Elias.

9 Responses to “How to Embed a RAP Application in a Web Page”

  1. Chris Aniszczyk (zx) says:

    Cool!!!

  2. AlBlue says:

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

  3. Chris Aniszczyk (zx) says:

    Is the source of this example available anywhere?

  4. GrimTim says:

    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.

  5. Elias Volanakis says:

    @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.

  6. Willian Mitsuda says:

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

  7. Elias Volanakis says:

    @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…

  8. Anonymous says:

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

    Maybe you meant the next 10 months? :)

  9. Elias Volanakis says:

    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.

9 responses so far

Written by . Published in Categories: EclipseSource News

Author:
Published:
Nov 19th, 2007
Follow:

Twitter GitHub