tag:blogger.com,1999:blog-9210566578097047576.post8803408796186276383..comments2023-11-05T02:04:07.740-08:00Comments on <coderthoughts />: Using Jersey (JSR311) inside OSGi with Spring-DMDavid Bosschaerthttp://www.blogger.com/profile/13786738766478890804noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-9210566578097047576.post-45143377399803990602012-06-01T01:46:46.458-07:002012-06-01T01:46:46.458-07:00Hi,
in the last couple of weeks I also created a ...Hi,<br /><br />in the last couple of weeks I also created a simple solution that picks up any OSGi Service and starts them as Jersey Rest API-s under the /rest/ context path if they have the following service-properties:<br /><br />service.exported.configs=com.sun.jersey<br />service.exported.interfaces=*<br /><br />This is basically a small part of the OSGi Remote Service specification. The annotations must be present on any of the interfaces the service object implements or on the service object itself (if the service object is proxied it is better to annotate an interface).<br /><br />You can check this solution at: http://everit.org/osgi/remote/org.everit.osgi.remote.jersey/index.html<br />And there is a sample project where the service is created via blueprint:<br />http://everit.org/osgi/samples/org.everit.osgi.samples.jaxrs/index.html<br /><br />The difference is that this does not use any spring related classes only jersey and OSGI related classes.<br /><br />Also as you do not have to pass class but object to Jersey you have the possibility to wire properties to your object in a way you like (e.g. with blueprint)<br /><br />Regards,<br />BalazsBalazs Zsoldoshttps://www.blogger.com/profile/07883654259084804549noreply@blogger.comtag:blogger.com,1999:blog-9210566578097047576.post-76471560887673425382010-10-12T02:54:50.953-07:002010-10-12T02:54:50.953-07:00Great to hear that the Jersey distro now also supp...Great to hear that the Jersey distro now also supports OSGi!David Bosschaerthttps://www.blogger.com/profile/13786738766478890804noreply@blogger.comtag:blogger.com,1999:blog-9210566578097047576.post-49460939770257413012010-10-12T02:20:19.876-07:002010-10-12T02:20:19.876-07:00There is an example in Jersey distribution to show...There is an example in Jersey distribution to show how to use OSGi Http Service with Jersey and Equinox. The only difference from the example in this blog post is it does not use Spring-DM, but it rather registers the Jersey Servlet directly in the OSGi bundle activator.<br />The example also includes a functional test based on Pax Exam framework.<br />The latest stable version of the example is available at [1]. After unzipping, you just need to uncomment the Equinox test exclude statement in functional-test/pom.xml<br /><br />Jakub<br /><br />[1]http://download.java.net/maven/2/com/sun/jersey/samples/osgi-http-service/1.4/osgi-http-service-1.4-project.zipUnknownhttps://www.blogger.com/profile/07721688647017994049noreply@blogger.comtag:blogger.com,1999:blog-9210566578097047576.post-28010729605598862882009-10-09T05:44:36.073-07:002009-10-09T05:44:36.073-07:00Hi Charles, yes I'm simply embedding the origi...Hi Charles, yes I'm simply embedding the original Jersey jars (and their dependencies) and referring to them using bundle classpath.<br />I can't fully remember how I got to the list of imported and exported packages, but I think I generated it using Peter Kriens' BND or the maven-bundle-plugin.David Bosschaerthttps://www.blogger.com/profile/13786738766478890804noreply@blogger.comtag:blogger.com,1999:blog-9210566578097047576.post-65306520356172492292009-10-09T04:31:21.077-07:002009-10-09T04:31:21.077-07:00Very interesting post David. I'm currently wor...Very interesting post David. I'm currently working on camel-web (using Jersey) that I would like to modify to be able to work on Apache Felix Karaf. I see in your post that you have used the command Bundle-classpath to import jersey classes.<br /><br />Have you created the list of packages to be imported/exported in MANIFEST file ?cmoulliardhttps://www.blogger.com/profile/06574597725926921707noreply@blogger.com