Hi all.  I've been following the Restlet project for a long time, and
we're finally in a position to decide to use it as the web layer in
several new projects.  We've also decided to use OSGi on the server as
the core runtime/deployment glue.

Restlet seems great; OSGi is great; - however, we've been struggling
somewhat with using the two together.  We are using Restlet 1.2M1 (but
most of these things happened also with restlet 1.1)

Here are some things we've encountered, and a few places we're currently stuck:

1)  The "org.restlet.jar" file is missing some imports in it's
Import-Package manifest file entries.  Specifically it is missing the
following packages imports:

javax.crypto,
javax.crypto.spec,
javax.net,
javax.net.ssl,
javax.security.auth,
javax.security.auth.callback,
javax.security.auth.login

The only packages automatically provided (implicitly imported) by the
osgi container are java.* packages.  Could this be a result of moving
the Engine implementation into the main restlet jar?

One thing to note here is that the restlet jar will load fine if
launched inside the Eclipse PDE environment.  It's only when it's
deployed in a standard (in this case equinox) osgi environment that
the bundle fails to start.

2) It was not obvious at all that we needed to call this method:

Engine.setUserClassLoader(this.getClass().getClassLoader());

in the Activator of our bundle which loads a restlet Component.  Yes,
we eventually found some references to this deep in the wiki and in
the discussion list.   But is also raises the question of whether
Restlet's bootstrapping strategy is fundamentally compatible with
OSGi- using this static singleton configuration doesn't play well with
osgi.  Also, what happens when we have multiple bundles providing
their own Applications and Resource subclasses- will their respective
Finders be able to instantiate them?

3) How can we get the restlet engine to use, for example, the Jetty
connector, in the OSGI environment?  We added the Jetty extension
bundle, as well as the various Jetty bundles, to our environment.  But
I can't see any evidence that they're being used.  the existing docs
only mention the conventional java jar-scanning technique, which
allows this to happen automatically in non-OSGi environments.

3b) Speaking of Jetty:  we already had a set of Jetty bundles deployed
in our environment.  So we didn't want to use the (slightly outdated)
version of Jetty included with the restlet distribution.  However, we
ran into one snag- While the core Jetty libraries are already valid
osgi bundles, their AJP extension jar is not currently "bundleized".
Because the org.restlet.ext.jetty bundle _requires_ the package
"org.mortbay.jetty.ajp", we were forced to make a custom bundle of the
jetty AJP extension, even though we have no intention of using the AJP
connector.  It would probably make more sense to have this be an
optional package import (I think the syntax is
"org.mortbay.jetty.ajp;resolution:=optional").

Okay, I have some more issues, but I'll put them in a seperate message!

Thanks,
  -Dave Fogel

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1217116

Reply via email to