Extending Virgo with a HttpService

Extending Virgo with a HttpService
Posted on 29th March 2011 by Chris Frost Several people have asked about us providing a packaging of Virgo that includes the OSGi HttpService. We don’t have any plans to do so because it’s so easy to extend Virgo with extra function yourself. I’m using the Equinox HttpService as the desired extra function here but the same approach applies no matter what you want to extend Virgo with.

All you need is the latest Virgo Kernel download, the Equinox HttpServer jar and it’s dependency the Servlet API jar. Unzip the Kernel and copy the two jars in to one of the repos. You have a choice of ‘repository/ext’ or ‘repository/usr’.

In this case ‘ext’ is the better choice as these bundles are being used to extend the core functionality of Virgo. If they were dependencies of an application then ‘usr’ would be the better choice.

There are two configuration files to edit.

■The ‘config/org.eclipse.virgo.kernel.userregion.properties’ file. At the very bottom, specify an additional initial artifact. The artifacts listed here will be started before any applications are installed. We need to list the Equinox HttpService bundle. The value is comma separated so after adding the new bundle you should have something like.
initialArtifacts =
repository:plan/org.eclipse.virgo.kernel.userregion.springdm,
repository:bundle/org.eclipse.equinox.http
■The HttpService requires some configuration itself, it needs to know which port to run on. This is given with the ‘org.osgi.service.http.port’ property and can be specified in the ‘lib/org.eclipse.virgo.kernel.launch.properties’ file.
org.osgi.service.http.port=8080
That’s all there is to it, start the kernel up and before any applications are installed the HttpService will be available. This is the same approach that should be used to extend Virgo in any other way and is exactly how the Tomcat and Jetty packages of Virgo are constructed. If you have extended Virgo in some way, let us know.
This entry was posted in Eclipse, OSGi, Virgo by Chris Frost. Bookmark the permalink.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值