# EntryPoint

###### Identifier:

org.eclipse.rap.ui.entrypoint

###### Since:

RAP 1.0

###### Description:

For every RAP application, an entry point must be registered with the framework. The framework will create a separate instance of this entry point for every user session. Entry points must implement the interface `EntryPoint`.

An application can register several entrypoints, each at a different URL path. To access an entry point, the path that it is registered at must be appended to the context path of the application.

As an alternative to registering an entrypoint, Eclipse applications can also use the interface `IApplication`.

###### Configuration Markup:

<!ELEMENT extension (entrypoint+)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

<!ELEMENT entrypoint EMPTY>

<!ATTLIST entrypoint

id CDATA #REQUIRED

path CDATA #REQUIRED

class CDATA #IMPLIED

applicationId IDREF #IMPLIED

brandingId IDREF #IMPLIED>

- id - The identifier of this entrypoint.
- path - The URL path to register the entry point at. Must start with a slash.
- class - An implementation of `EntryPoint` which starts the application. Either this attribute or applicationId must be specified.
- applicationId - The id of an IApplication extension to start instead of an EntryPoint class.
- brandingId - Specify the (optional) branding that should be used if this entry point is started.

###### Examples:

    <extension
        id="org.eclipse.rap.demo.demoentrypoint"
        point="org.eclipse.rap.ui.entrypoint">
      <entrypoint
          id="example.entrypoint"
          class="example.MyEntrypoint"
          path="/myapp"/>
    </extension>

###### API Information:

Each entrypoint must implement the interface `EntryPoint`. In the createUI() method, the user interface of the application is created. An entrypoint for a simple RAP application could look like this:

    public class MyEntryPoint implements EntryPoint {

      public int createUI() {
        Display display = new Display();
        Shell shell = new Shell( display );
        shell.setLayout( new GridLayout() );

        Label label = new Label( shell, SWT.NONE );
        label.setText( "Hello World!" );

        shell.layout();
        shell.open();
        return 0;
      }
    }

Copyright (c) 2007, 2015 EclipseSource and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html