Restlet integration with Equinox and RCP_82903346 - Gumtree/gumtree GitHub Wiki

Created by Tony Lam, last modified on May 21, 2008

Restlet bundle

All restlet lib are packaged as OSGi bundles from the official download, but those cannot be run inside the Equinox runtime due to the classloader problem.  Our approach is to create a big fat bundle that contains the necessary code to run restlet under the embedded Jetty server in Equinox.  Those included org.restlet (API), com.nelios.restlet (reference implementation), and com.nelios.restlet.ext.servlet (servlet request support).

Embedding Restlet inside RCP

Eclipse RCP's help system is basically an instance of Jetty server.  Our first attempt is to make restlet available on that Jetty instance.  There are two problems: 1) port are randomly generate, 2) context.path is hardcoded to /help (by org.eclipse.help.base).  The first problem can be solved by using vm argument -Dserver_port=<port>.  The second problem is very tricky, and this populates the URI heirarchy where all restlet URI will include "/help".  The solution to this is NOT to use the Jetty instance from Eclipse's help system.  Under our restlet bundle, we need support on starting new server during activation.  When we launch our restlet enabled application, we need to pre-start the restlet bundle +http registry bundle.

References:

NASA's Ensemble REST Framework: http://blog.noelios.com/2008/05/05/nasa-launch-restlet-on-osgi-orbit/

Comments:

Hi Tony, In the recent Restlet 1.1 M4 release, we improved our support for OSGi bundles. Previous classpath issues were resolved by adding OSGi activators to Restlet JARs. Hope that helps,
Jerome
Image:images/icons/contenttypes/comment_16.png Posted by jlouvel at May 22, 2008 04:15
Document generated by Confluence on Apr 01, 2015 00:11
⚠️ **GitHub.com Fallback** ⚠️