Skip to main content
Jump to: navigation, search

EclipseLink/Development/DBWS/OSGi/AdvCustIJetty

< EclipseLink‎ | Development‎ | DBWS‎ | OSGi


Advanced Customization - Part I: Jetty

The above example relies on the built-in JavaSE HTTP server (com.sun.net.httpserver.HttpServer) which has some known issues (6675392, 6946825). A user may wish to 'swap-in' a different HTTP Server, such as Jetty, which can be added to the PDE Target Platform from the Helios P2 Update Repository:

EclipseLink DBWS with OSGi in PDE.png

Open the Manifest Editor and add the following to the Required Plug-ins list of dependencies:

org.eclipse.jetty.continuation
org.eclipse.jetty.http
org.eclipse.jetty.io
org.eclipse.jetty.server
org.eclipse.jetty.util

There is a system property to override the built-in JavaSE HTTP server class:

-Dcom.sun.net.httpserver.HttpServerProvider=org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider

{NB - the SPI used to load the new HttpServerProvider class is not OSGi-friendly; a revised version of com.sun.net.httpserver.spi.HttpServerProvider can be found here}

The new HttpServerProvider can be found in maven .../org/mortbay/jetty/jetty-jaxws2spi/7.0.1.v20091125 in the package org.eclipse.jetty.jaxws2spi

prompt> ls
JAXWS2ContextHandler.java  JettyHttpServer.java
JettyHttpContext.java      JettyHttpServerProvider.java
JettyHttpExchange.java     ThreadPoolExecutorAdapter.java

Once the above classes are added to the project and the required configuration changes are done, the existing code in simpletable.Activator will run - using Jetty - without modification.
EclipseLink DBWS with OSGi SimpleTable with Jetty running.png

Back to the top