It is possible to use RAP without OSGi. In that case RWT is used like normal Java library. It is recommended to use the RAP Tooling for developing RWT applications. Though it is not strictly necessary to use the tooling, it eases development with a launch configuration tailored for RWT applications and documentation.
Follow the steps outlined below and you will have a simple web application up and running in a few minutes.
public class HelloWorld extends AbstractEntryPoint { public void createContents( Composite parent ) { Label label = new Label( parent, SWT.NONE ); label.setText( "Hello RAP World" ); } }
With the RAP Tooling installed, you can already launch your HelloWorld application. To do so, select the HelloWorld class (i.e. in the Package Explorer) and choose Run As > RWT Application from the context menu.
If you wish to deploy your application on an external servlet engine, or if you need a deployment descriptor for other reasons, or you haven't installed the RAP Tooling, a few more steps are required to run the application.
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <context-param> <param-name>org.eclipse.rap.applicationConfiguration</param-name> <param-value>com.example.HelloWorldConfiguration</param-value> </context-param> <listener> <listener-class>org.eclipse.rap.rwt.engine.RWTServletContextListener</listener-class> </listener> <servlet> <servlet-name>rwtServlet</servlet-name> <servlet-class>org.eclipse.rap.rwt.engine.RWTServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>rwtServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app>
public class HelloWorldConfiguration implements ApplicationConfiguration { public void configure( Application application ) { application.addEntryPoint( "/hello", HelloWorld.class, null ); } }
Run from web.xml. Enter the location of the web.xml file and specify
helloas the servlet path.
You may also find the JFace components useful. In order to use them from RWT standalone, you will need to add the following jars from the RAP Runtime: