# Creating Projects Configured for REST

To use REST in OEPE, first create a project that is configured to support REST (JAX-RS) services. You can do this in a couple steps using the web project wizards in the OEPE interface.

There are two types of projects that use REST:

- Dynamic Web project

- Java Web project

## How to Create a Dynamic Web Project that is Configured for REST

When you create a dynamic web project that is configured for REST, the system adds a `web.xml` file and a `weblogic.xml` file that contain the REST servlet and servlet mapping detail that your project uses at runtime, as shown in Example: web.xml configured for REST and Example: weblogic.xml configured for REST.

web.xml configured for REST

    <display-name>REST Project</display-name>
     <servlet>
    <description>JAX-RS Tools Generated - Do not modify</description>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <load-on-startup>1</load-on-startup
     </servlet>
      <servlet-mapping>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <url-pattern>/jaxrs/*</url-pattern>
     </servlet-mapping>
    </web-app

weblogic.xml configured for REST

    <wls:weblogic-version>12.1.3</wls:weblogic-version
      <wls:context-root>REST_Project</wls:context-root>

To create a dynamic web project configured for REST

1. Create a WebLogic runtime. Both Weblogic 11g and 12c versions are supported. These steps are for Weblogic 12c. For Weblogic 11g, the wizard interface is slightly different, and adds a `weblogic.xml` file with a jax library reference `<wls:library-name> jax-rs</wls:library-name>`.

2. In the OEPE application, choose File > New > Web > Dynamic Web Project.

3. Click Next. The New Dynamic Web Project dialog appears, as shown in Figure: Create Dynamic Web Project with REST. Add the project detail, and choose the target runtime. The target runtime is shown in the Configuration field.

4. Next to the Configuration field, click Modify to choose what capabilities to enable for your project. The Project Facets dialog appears, as shown in Figure: Add REST Facets to a Dynamic Web Project.

5. Select JAX-RS (REST Web Services). Click OK.

6. Click Next. The JAX-RX Capabilities dialog appears with the default servlet and container details. If you accept the defaults click Finish.

   Note: When you change the class or project class path in the run configuration wizard you should manually stop the JAXRS application and restart it to reflect your changes. Unless it is stopped and started again , it will not reflect the changes.

   Create Dynamic Web Project with REST

   Add REST Facets to a Dynamic Web Project

## How to Configure a Java Project for REST

To use REST with your Java web project you need to add the JAX-RS library bundle to your Java project. To do this, convert your Java project to a JAX-RS faceted project.

To convert a Java project for REST

1. Select your Java project. Right-click and choose Configure > Convert to Faceted Form

2. In the Facet Page select JAX-RS and the appropriate runtime version, as shown in Figure: Convert a Java Project for REST - Add Project Facets.

3. Notice the "Require Further Configuration" link highlighted in the lower part of the dialog. Click Require Further Configuration to continue to the JAX-RS Facet Install dialog, as shown in Figure: Convert a Java Project for REST - Add JAX-RS Capabilities.

4. In the JAXRS Facet Install Page, Select User Library.

5. Select the download button, or select from the previously configured user libraries available for your JAX-RS Runtime, shown in the libraries window. The Jersey Download is now available. to initiate

6. Click OK.

Convert a Java Project for REST - Add Project Facets

Convert a Java Project for REST - Add JAX-RS Capabilities