The project Remote Application Platform (RAP) (http://eclipse.org/rap/) provides the development of modular applications with the same code for desktops, allowing easy converting desktop RCP applications to Web applications, for Web browsers, and for mobile devices using the Java and Eclipse technologies.
The project RAP includes the Web adaptation of the SWT (RWT), JFace, Workbench and Forms, integration with the OSGI, various extensions, Branding and Interaction Design API, tools, examples, and themes.
 
The project RAP provides the development of RIA (Rich Internet Application) Ajax applications, the GUI of which is created without HTML markup and JavaScript, but only using the Java language with the use of the Web implementations of the libraries SWT (RWT), JFace, Workbench and Forms and data binding. Moreover, RAP applications run on the Web browser without the need to install plug-ins. Furthermore, the project RAP allows converting existing RCP applications in Web applications with slight modifications.
 
The project RAP is represented by the product Eclipse for RCP and RAP Developers, which is available for download at http://www.eclipse.org/downloads/.
The RAP framework can be used in conjunction with such Eclipse technologies as the EMF, BIRT, Riena, and Scout.
The API of the RAP platform is similar to the API of the RCP platform that allows you to easily transform RCP applications to RAP applications. Therefore the development of RAP applications in the Eclipse IDE is based on the PDE plug-in with the support for the RAP platform and the target development platform is the RAP platform.
 
Note
The target platform – is a set of Eclipse plug-in on which developed plug-ins should run.
 
The RAP platform includes the runtime Equinox with the built-in Jetty server and the Servlet container, the libraries RWT (RAP Widget Toolkit), RAP-JFace, RAP-Workbench and RAP-Forms, as well as examples and demonstrations.
The RAP application can be deployed in any Servlet container with installed plug-ins of the RAP platform or in the runtime of the standalone RAP platform. Applications developed and deployed on the RAP platform are available from the Web browser using HTTP requests.
 
The basis of the GUI of RAP applications is the graphical system RWT (RAP Widget Toolkit) – the Web implementation of the SWT, on the one hand imposes restrictions on the SWT and on the other hand – supplements it with Web capabilities.
Moreover, each RWT component of the GUI of the RAP application consists of two parts – the client (RAP Web client) part and the server part that interacts with the client through Ajax requests.
 
The server part of the RWT system runs in the Equinox runtime and the client part is based on the modified JavaScript framework qooxdoo (http://qooxdoo.org/) and works in the Web browser.
 
The client part of the RWT system is responsible for displaying GUI components and the server part is responsible for handling its events and for changing the display of GUI components. On the Web browser page the RWT system creates the Ajax code that calls the JavaScript libraries of the RAP platform to display the appropriate GUI components. The RWT system is the basis for the Web implementations of the JFace and Workbench.
 
The RAP Web client communicates with the server part using the RAP Protocol that is based on HTTP requests and JSON messages. The defined RAP protocol allows using any other client instead of the RAP Web client.
 
The RAP Web client provides the support for the Web browsers such as the Internet Explorer 7 +, Google Chrome 7 +, Firefox 4 +, Safari 4 +, Opera 10 +, iOs 5 +, and Android 3 + (with restrictions).
 
When developing RAP applications for mobile devices, it is recommended to create separate themes taking into account the small screen. Also, the testing of the RAP Web client is required for the browser Android 3 +.
 
RAP vs JavaFX
 
Both platforms RAP and JavaFX provide the creation of RIA applications.
 
RCP/RAP and JavaFX applications have the same code to work as a desktop application and as a Web application. However, the work of the Web RAP application on the client side does not require installing the JRE, but the work of the Web JavaFX application – require, as the JavaFX plug-in is needed for the work of the JavaFX application in the Web browser.
JavaFX applications do not work yet in mobile devices.
 
The JavaFX platform is designed to create a GUI of applications, but the platform RAP – to create client-server applications.
 
RAP vs GWT
 
Both platforms RAP and GWT provide the creation of RIA applications.
The GWT application can not work as a desktop application.
RAP and GWT applications can run on mobile devices.
The work of RAP and GWT applications in the Web browser do not require the installation of plug-ins.
The code on the client-side of the GWT application is translated into the JavaScript code, but the code on the client-side of the RAP application is always the Java code – the RAP platform contains the JavaScript Web client that provides the sending of user events to the server side and receiving the information about changes of properties of GUI components.
 
Getting Started with the RAP Platform
 
To start working with the RAP platform you can download the product Eclipse for RCP and RAP Developers (http://www.eclipse.org/downloads/). This distribution already includes the set of the plug-ins RAP Tooling, which provide tools, documentation, and templates to develop RAP applications.
 
However, to work you should also install the RAP platform itself. The RAP platform installation is provided by the Welcome page of the product Eclipse for RCP and RAP Developers or initially the wizard of the RAP application creation.
To install the RAP platform using the Welcome page, let’s open the Eclipse for RCP and RAP Developers and from the Help menu let’s select the command Welcome.
 
On the Welcome page let’s click the button Overview and then the link Rich Ajax Platform (RAP). On the next page let’s click the link Install Target Platform – as a result, the dialog box will be opened that providing the installation of the RAP platform, while the selection of the checkbox Activate the target after installation automatically assigns the installed RAP platform as the target Eclipse development platform.
 
After installation you can see in the section Plug-in development | Target Platform of the command Preferences from the Eclipse menu Window that the installed RAP platform is assigned as the target Eclipse development platform.
 
RAP Application Development
 
To create a RAP application let’s open the Eclipse perspective Plug-in Development and from the File menu let’s choose the New | Plug-in Project, type the name of the project, under the section Target Platform let’s select the Eclipse version:, click the Next and uncheck the Generate an activator ... and click the Next. Further, the window Templates of the wizard to create an Eclipse plug-in project provide the selection of the RAP application templates:
 
RAP Hello World – the sample of the RWT application that displays the checkbox and button in a Web browser.
RAP Mail Template – the sample of the RAP application that emulates the mail client in a Web browser.
 
After selecting the RAP template and clicking the Finish, if the RAP platform was not installed, the window of the wizard to install the RAP platform is opened.
 
To run the RAP application from the Eclipse IDE, in the view Package Explorer let’s right-click the project node and from the context menu let’s select the Run As | Run Configurations.
In the tab Main of the configuration of the section RAP Application of the wizard, let’s choose in which Web browser the application will be launched.
 
Click the buttons Apply and Run. As a result, the page of the RAP application will be opened in the Web browser.
 
Viewing the Web page code, you can see that the Web browser loads the JavaScript library rap-client.js, on the basis of which the code to display the GUI is provided in the block <script type="text/javascript"> </ script>.
The platform RAP with the extension org.eclipse.rap.ui.branding provides the branding of RAP applications, similar to the way how the extension org.eclipse.core.runtime.products does it for RCP applications.
 
Using the RAP Mail Template with the checked Use business theme and layout ..., let’s create the RAP application and open the node of the extension org.eclipse.rap.ui.branding in the tab Extensions of the PDE editor.
 
The field title allows you to define the title of the Web page of the RAP application.
The field favicon defines the favicon of the RAP application Web page.
The field body allows including an additional HTML code in the tag <body> of the RAP application Web page using an HTML file that contains the tag <body> with HTML code.
The field themeId allows changing the appearance of the RAP application in the Web browser using CSS styles.
The command New | additionalHeaders allows defining the additional HTML tags link and meta.
 
To create your own CSS style of the RAP application you need to create the CSS file and place it in the RAP project. Do not forget to include additional resources to the project building using the checkboxes in the tab Build of the PDE editor.
In the tab Extensions of the PDE editor with the button Add, let’s add the extension org.eclipse.rap.ui.themes and right-click on its node, from the context menu let’s choose the New | theme and define the created CSS file using the button Browse in the field file.
 
Save the changes and let’s choose the identifier of the created theme using the button Browse in the field themeId. Now when running the RAP application, the created CSS styles will be applied to the application’s Web page.
 
Note
 
To add all the necessary plug-ins when launching the application from the Eclipse IDE, you need to use the button Add Required Bundles of the tab Bundles of the command Run As | Run Configurations.
 
To deploy the RAP application in the Servlet container, you should create the WAR file of the application. To do it you can use the tool WAR Products, which can be installed in the Eclipse IDE.
In the menu Help let’s select the command Install New Software, in the field Work with: let’s select the address of the Eclipse release, under the section Web, XML, Java EE and OSGi Enterprise Development let’s check the WAR Products and click the Next.
 
After installing the tool WAR Products, in the view Project Explorer let’s right-click on the node of the RAP project and from the context menu let’s choose the New | Other | Plug-in Development | WAR Product Configuration, click the button Next, in the field File name: type the file name, while selecting the Use a launch configuration:, and click the Finish.
 
In the tab Configuration let’s check the Include optional dependencies ... and click the Add Required Plug-ins.
In the tab Overview of the editor of the warproduct file, let’s click the link Eclipse WAR Product export wizard, choose the directory to export the WAR file and click the Finish – as a result you obtain the WAR file of the RAP application.
Put the created WAR file of the RAP application in the folder webapps of the Tomcat server directory and run the server using the tool startup.bat of the folder bin.
 
In the address bar of the Web browser, let’s type the address http://127.0.0.1:8080/rapmail/mail or http://127.0.0.1:8080/raphello/hello – as a result, you will see the Web page of the RAP application.
The above type of RAP applications is an analog of RCP applications and extends the approach of the Rich Client Platform (RCP) to the architecture Web 2.0.
 
Unlike the RAP Mail Template, which represents an example of the RAP application that has the dependency from the plug-in org.eclipse.rap.ui, the template RAP Hello World represents an example of the RWT application.
RWT applications are analogues of SWT applications and allow using the SWT API to create GUIs of RIA applications. The difference of the RWT application from the RAP application is that the RWT application does not use the Workbench and depends on the plug-in org.eclipse.rap.rwt.
 
Converting SWT applications to RWT applications
 
To create RWT applications you can use the plug-in WindowBuilder (http://www.eclipse.org/windowbuilder/).
The installation address of the WindowBuilder plug-in for the command Install New Software from the Help menu can be taken using the page at http://www.eclipse.org/windowbuilder/download.php.
 
After installing the WindowBuilder plug-in, in the File menu of the Eclipse IDE configured to work with the RAP platform, let’s choose the New | Plug-in Project, type a project name and click the Next, uncheck the Generate an activator, ... and the This plug-in will make contributions to the UI and click the Finish. As a result, the empty application project will be created based on the RAP platform.
 
In the tab Dependences of the PDE editor of the plug-in’s MANIFEST.MF file with the button Add, let’s add the dependency org.eclipse.rap.rwt, typing «org» in the field Select a Plug-in.
 
In the view Package Explorer let’s right-click the project node and from the context menu let’s select the New | Other | WindowBuilder | SWT Designer | SWT | Application Window and click the button Next, let’s type the package name and class name, select the public static main() method and click the Finish. As a result, the Java class with the entry point – the method main() will be generated, in which the Shell window with the title is created.
 
But the RWT application has another entry point – the main application class should implement the interface org.eclipse.rap.rwt.application.EntryPoint with the definition of its method public int createUI(). Therefore, let’s modify the code of the generated class:
import org.eclipse.rap.rwt.application.EntryPoint;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
 
public class Main implements EntryPoint{
public int createUI() {
Display display = new Display();
Shell shell = new Shell( display );
shell.setText( "Hello World" ); 
shell.open(); 
return 0;
}}
 
The modified class can still be opened in the WindowBuilder editor, the Design tab of which provides visual editing of the GUI.
To run the RWT application from the Eclipse IDE you can by clicking on the project node in the view Package Explorer and from the context menu selecting the Run As | RWT Application. As a result, the page of the RWT application will be opened in the Web browser.
 
To deploy the RWT application in the Servlet container, the application project should have a class that implements the interface org.eclipse.rap.rwt.application.ApplicationConfiguration, as well as it should have the structure similar the project based on the template RAP Hello World.
 
Converting RCP applications to RAP applications
 
To create the RCP application let’s open the perspective Plug-in Development of the Eclipse IDE and from the File menu let’s choose the New | Plug-in Project, type the name of the project, under the section Target Platform let’s select the Eclipse version:, click the button Next, uncheck the Generate an activator ... and select the Yes under the section Rich Client Application and click the Next.
 
Select the template Hello RCP and click the Finish.
 
In the tab Dependences of the PDE editor let’s replace the dependence org.eclipse.ui on the dependence org.eclipse.rap.ui.
In the Extensions tab with the button Add let’s add the extension point org.eclipse.rap.ui.entrypoint.
In the field Id of the properties of the extension point, let’s type rcpapp.entrypoint.
 
In the field path let’s type /rcpapp.
In the field applicationId with the button Browse let’s choose the application identifier RCPApp.application.
Right-click the project node and from the context menu let’s select the Run As | Run Configurations.
Right-click on the node RAP Application and select the command New.
In the field Servlet path of the Main tab let’s type /rcpapp.
In the Bundles tab let’s select the application checkbox and then click the Apply and Run.
As a result, the RCP application will be started as the RAP application.
To clear the launch configuration of the RAP application you can use the folder user\workspace\.metadata\.plugins\org.eclipse.rap.tools.launch.
 

You can download the book Beginning Eclipse 4: Development of RCP, Web, Ajax, and Android applications here.

Our services

Our developments are at the forefront of high technologies

We design and develop web sites

Individual site design
Creating dynamic sites
Website layout and programming

We develop information systems

Automation of business processes for small and medium business
Collection, storage and processing of data
Using cloud technologies

We create mobile apps

Integration with a Web site
Creating mobile versions of web sites
Using Augmented Reality and Computer Vision

About us

NOV Tech Solutions specializes in developing services for operational management of business, creating web and mobile applications on order

NOV Tech Solutions is a team of highly qualified professionals working for the result

We work quickly and efficiently, using the most modern technologies

We appreciate and take care of our customers, constantly improving the service and expanding the list of services

Our partners

Contacts