Your WebContextFactory would become a service that your DUP installs.
On 07/18/2012 02:24 PM, Thomas Diesler wrote:
Yes, this could work. However it's probably better to use a
dependency
on the HostBundleActiveService.
Generally, services that have a dependency on a particular bundle
state should do this via ordinary service dependencies rather via
async listeners on bundle events. So you would have a
BundleContextInjection service with an injected bundle dependency on
the HostBundleActiveService.
cheers
-thomas
On 07/18/2012 01:56 PM, David Bosschaert wrote:
> Hi all,
>
> I began completing the OSGi WAB support that Thomas started some time
> ago. The first piece I looked at is AS7-5203 which gives Servlets access
> to the OSGi BundleContext via the ServletContext.
>
> Before filing a pull I'm looking for some feedback on how I implemented
> this. Maybe people have thoughts re how it can be improved or
> simplified. It currently works like this:
> * I added a DeploymentUnitProcessor in the REGISTER phase that adds a
> WebContextFactory.ATTACHMENT to the deployment unit.
> * This attachment is picked up by JBoss Web (it already provided this
> hook).
> * When the Bundle representing the WAB is started it calls back into the
> WebContextFactory to set the BundleContext in the ServletContext. It
> does this via a MSC Service that in turn uses an OSGi BundleListener.
>
> The changes are here:
>
https://github.com/bosschaert/jboss-as/commit/9ab72ce08a3357a3e6fdb1a68c2...
>
>
> Thanks,
>
> David
>
> _______________________________________________
> jboss-osgi-dev mailing list
> jboss-osgi-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/jboss-osgi-dev
--
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx