Testing with Jetty

Jetty is a Web Server integrated within Eclipse. It enables to test and debug your plug-in within Eclipse itself . Using Jetty, you don't have to deploy to test what you are building.

Creating a Jetty Launch Configuration

Here are the steps to launch Jetty from Eclipse:

  1. Create a Launch Configuration:
    1. Click Run > Run Configurations...
    2. In the Run Configurations dialog select OSGI Framework and right-click New.
    3. Set for example MDWorkbench Server as configuration name.
    4. Click Apply to save the changes.
       
  2. Configure the launched Plug-Ins:
    1. Select the Bundles tab.
    2. Click Deselect All
    3. Select the following plug-ins:
      • MDWorkbench Server plug-ins:
        • com.sodius.mdw.core.*
        • com.sodius.mdw.server.*
      • Metamodels plug-ins, e.g.:
        • com.sodius.mdw.metamodel.doors
        • com.sodius.mdw.server.doors
      • Jetty plug-ins:
        • org.eclipse.jetty.*
      • Apache Felix plug-ins:
        • org.apache.felix.gogo.*
      • Equinox plug-ins:
        • org.eclipse.equinox.http.*
        • org.eclipse.equinox.jsp.*
        • org.eclipse.equinox.console
      • Also select the plug-ins you created, in which you added extensions to MDWorkbench Server.
    4. Click Add Required Bundles to automatically add all plug-ins required by the ones selected.
    5. Click Apply to save the changes.
       
  3. Configure Launch Arguments:
    1. Select the Arguments tab.
    2. In the VM Arguments text area, add the following properties:
      • -Dorg.eclipse.equinox.http.jetty.http.port=27888
      • -Dorg.eclipse.equinox.http.jetty.context.path=/mdworkbench
      • -Dorg.eclipse.equinox.servlet.bridge.enabled=true
      • -Dmdw.license=<path to license file or server>
    3. If you intend to use Administration features, in the VM Arguments text area, add the following properties:
      • -Dorg.eclipse.equinox.http.jetty.customizer.class=com.sodius.mdw.server.jetty.AuthCustomizer
      • -Dmdw.server.jetty.users.location=<path to Jetty users file>
    4. Click Apply to save the changes.

Running Jetty

Here are the steps to execute Jetty in Run mode:

  1. Click Run > Run Configurations...
  2. Select the Jetty configuration created in previous steps and click Run.
  3. Open a web browser on the following URL:
    localhost:27888/mdworkbench/web/index.html

Debugging Jetty

Here are the steps to execute Jetty in Debug mode:

  1. Click Debug > Debug Configurations...
  2. Select the Jetty configuration created in previous steps and click Debug.
  3. Open a web browser on the following URL:
    localhost:27888/mdworkbench/web/index.html

You can add breakpoints in your Java code invoked within MDWorkbench Server, for example in the implementation of your Service. When executing Jetty in Debug mode, execution suspends in Eclipse on your breakpoints and variables can be inspected.

Related tasks
Creating Plug-Ins
Adding Services