Twitter Logo Follow us on Twitter
Project Information About this project

Choosing an Application Setup

RAP can be combined with various other technologies and deployed in different setups. Your choice of an application setup depends on the technologies you want to use and the server you need to deploy the application on.

OSGi or stand-alone?

OSGi is a module platform for Java that allows you to organize your application in loosely coupled modules, called bundles, that communicate over a service infrastructure. Eclipse is based on OSGi and provides a lot of bundles that you can re-use in your application. RAP is designed to work with any standard-compliant OSGi implementation. It is often used on Equinox, the OSGi reference implementation by Eclipse, but can also run on other OSGi containers like Apache Felix.

If you don't need or don't like to use OSGi in your web application, you can still use RWT as a normal Java library. This setup is usually referred to as RWT standalone.

Direct or WAR-Deployment?

OSGi-based applications can be deployed in basically two different ways.

  • The application bundles can be deployed directly in an OSGi container such as Equinox or Felix. In this case, a servlet engine bundle must be running in the same OSGi instance. The Jetty servlet engine is available as OSGi bundles and is a good choice for this setup.
  • It is also possible to deploy an OSGi-based application to a servlet container. To do so, an Equinox OSGi instance including the application bundles is wrapped in a web archive (.war file) using the Equinox servlet bridge. This approach is explained in the WAR deployment guide.

When using RWT stand-alone, the RWT servlet is configured directly in the application's web.xml file.

JEE or SWT compatibility?

RWT has two different modes of operation, which can be configured in the application configuration. The default one is fully compatible with JEE, lightweight, and supports transparent session failover in clustering environments (clustering currently requires an RWT standalone setup). This is the recommended operation mode in most cases.

As an alternative, the SWT compatibility mode exactly emulates the SWT threading model. To make this possible, a separate UI thread has to be started for every user session. As a consequence, the code running in the UI thread cannot directly access JEE transaction or security contexts.

The SWT compatibility mode is only required for code that uses SWT's few blocking APIs. The most obvious case are blocking dialogs (i.e. calling will suspend code execution until the dialog is closed by the user, and then return a value). In JEE mode, code execution will continue after opening the dialog, but any operations reacting to closing the dialog must be done in a callback. RAP provides an additional API that can be used for those dialog callbacks. This mechanism does not exist in SWT.

Another blocking API in SWT are the Browser-widget's execute and evaluate methods. Their return value can also be obtained using callback API, but this may be problematic when developing browser-based custom widgets.

Eclipse Workbench (RCP)

If you're building an application based on the Eclipse workbench, you need a platform that includes the Equinox OSGi implementation and the extension registry. Moreover, these applications require the SWT compatibility mode.

Eclipse 3.x

The application and all contributions, such as views or themes, must be registered as extensions.

Eclipse 4.x

Eclipse 4.x applications can run on RAP using the E4 support in the RAP Incubator. For details, see the RAP E4 wiki page.


Here is a comparison of 3 typical RAP-setups:

RAP with OSGi RAP with Workbench RWT Standalone
Summary Lightweight and flexible, recommended for new applications that do not use Eclipse extensions For applications using the Eclipse Workbench (RCP applications) No OSGi, RWT used as a library in a traditional web app
OSGi Compatible with any OSGi implementation including Equinox Eclipse Equinox required No OSGi
Deployment As WAR file in servlet container or directly in OSGi container with embedded server. Direct access to JEE contexts possible with JEE compatibility mode. As WAR file in servlet container or directly in OSGi container with embedded server. As WAR file in servlet container. Direct access to JEE contexts possible with JEE compatibility mode. Clustering supported.
Configuration Using the Application Configuration API Using extension points Branding Using the Application Configuration API RWT servlet and application configured in web.xml.
Entry-point EntryPoint EntryPoint or IApplication EntryPoint
Operation Modes SWT or JEE compatibility mode SWT compatibility mode enforced SWT or JEE compatibility mode
RCP Compatibility SWT, JFace SWT, JFace, Workbench SWT, JFace
Launch from IDE RAP Launcher RAP Launcher RWT Launcher