| <?xml version="1.0" encoding="UTF-8" ?> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta name="copyright" content="Copyright (c) 2012, 2019 EclipseSource. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page."/> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| <title>RWT standalone</title> |
| <link rel="stylesheet" href="../../../PRODUCT_PLUGIN/book.css" type="text/css"/> |
| </head> |
| <body> |
| |
| <h1>RWT Standalone</h1> |
| <p> |
| It is possible to use RAP without OSGi. In that case RWT is used like normal Java library. |
| It is recommended to use the <a href="http://eclipse.org/rap/downloads/" >RAP Tooling</a> |
| 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. |
| </p> |
| |
| <h2>Create and launch the application</h2> |
| <p> |
| Follow the steps outlined below and you will have a simple web application up and running in a |
| few minutes. |
| </p> |
| <ul> |
| <li> |
| Create a <em class="UiLabel">Java Project</em> (or a <em class="UiLabel">Plug-in Project</em> |
| if you prefer, and are familiar with plug-in development) |
| </li> |
| <li> |
| Configure the project to match the layout of a web application. You may skip or postpone |
| this step if you are using RAP Tooling to launch the application. The layout is necessary |
| if you want to deploy the project as a WAR. |
| <ul> |
| <li> |
| Create the three folders: <em>WEB-INF</em>, <em>WEB-INF/lib</em>, |
| <em>WEB-INF/classes</em> |
| </li> |
| <li> Change the projects' output folder to <em>WEB-INF/classes</em>. </li> |
| </ul> |
| </li> |
| <li> |
| Copy the <em>org.eclipse.rap.rwt_*</em> jar from the |
| <a href="http://eclipse.org/rap/downloads/">RAP Runtime</a> into the <em>WEB-INF/lib</em> |
| folder and add it to the projects' build path. The <em>org.eclipse.rap.rwt.source_*</em> |
| jar contains the RWT source code. To be able to browse the sources and read JavaDoc, specify |
| this jar as the<em class="UiLabel"> |
| <a href="http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-properties-source-attachment.htm"> |
| Source Attachment |
| </a></em> |
| </li> |
| <li> Implement an |
| <em><a href="../reference/api/org/eclipse/rap/rwt/application/EntryPoint.html">EntryPoint</a></em> |
| like below: |
| <pre class="lang-java"> |
| public class HelloWorld extends AbstractEntryPoint { |
| public void createContents( Composite parent ) { |
| Label label = new Label( parent, SWT.NONE ); |
| label.setText( "Hello RAP World" ); |
| } |
| }</pre> |
| </li> |
| </ul> |
| <p> |
| With the RAP Tooling installed, you can already launch your HelloWorld application. |
| To do so, select the <em>HelloWorld</em> class (i.e. in the |
| <em class="UiLabel">Package Explorer</em>) and choose |
| <em class="UiLabel">Run As</em> > <em class="UiLabel">RWT Application</em> from the context menu. |
| </p> |
| |
| <h2 id="deploy">Deploying</h2> |
| <p> |
| 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. |
| </p> |
| <ul> |
| <li> Place a deployment descriptor (<em>web.xml</em>) in the <em>WEB-INF</em> folder |
| with the content below: |
| <pre class="lang-xml"> |
| <?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> </pre> |
| </li> |
| <li> |
| Provide an <a href="application-configuration.html">application configuration</a> |
| to configure your application like shown below: |
| <pre class="lang-java"> |
| public class HelloWorldConfiguration implements ApplicationConfiguration { |
| public void configure( Application application ) { |
| application.addEntryPoint( "/hello", HelloWorld.class, null ); |
| } |
| }</pre> |
| </li> |
| <li> |
| Again you can use the RAP Tooling to launch the application from the just created |
| <em>web.xml</em>. To do so, create a new <em class="UiLabel">RWT Launch Configuration</em> |
| and select <q><em class="UiLabel">Run from web.xml</em></q>. |
| Enter the location of the <em>web.xml</em> file and specify <q><em>hello</em></q> as the |
| servlet path. |
| </li> |
| </ul> |
| <p> |
| You may also find the <a href="http://wiki.eclipse.org/index.php/JFace">JFace</a> components |
| useful. In order to use them from RWT standalone, you will need to add the following jars from |
| the <a href="http://eclipse.org/rap/downloads/">RAP Runtime</a>: |
| </p> |
| <ul> |
| <li> <em>org.eclipse.rap.jface</em></li> |
| <li> <em>org.eclipse.core.runtime</em></li> |
| <li> <em>org.eclipse.core.commands</em></li> |
| <li> <em>org.eclipse.equinox.common</em></li> |
| </ul> |
| |
| </body> |
| </html> |