Someone has pointed out that the resolution:=optional attribute solves my problem.
thanks Jan On 11 April 2014 17:58, Jan Bartel <[email protected]> wrote: > Hi, > > I've just started using SpiFly with Jetty in order to support the > Servlet Spec requirement to find ServletContainerInitializer impls via > the ServiceLoader mechanism. > > I've configured the manifest of the jetty-annotations bundle that > calls the ServiceLoader as suggested in the SpiFly doco: > > <Require-Capability>osgi. > serviceloader; > filter:="(osgi.serviceloader=javax.servlet.ServletContainerInitializer)";cardinality:=multiple, > osgi.extender; > filter:="(osgi.extender=osgi.serviceloader.processor)"</Require-Capability> > > Everything works as expected if there is indeed another bundle that > has the correct <Provide-Capability> header to advertise the presence > of a ServletContainerInitializer. > > However, if there are no such bundles, the jetty-annotations bundle > does not deploy fully, complaining that there is a missing > requirement: > > Missing required capability Require-Capability: osgi.serviceloader; > filter = "(osgi.serviceloader = > javax.servlet.ServletContainerInitializer)". > > It is NOT a requirement of Jetty nor the Servlet Spec that there are > any ServletContainerInitializers - the jetty-annotations module when > running outside of osgi runs happily if the ServiceLoader reports no > instances. > > My question is: is there a way to achieve the same behaviour > (optionality of any ServletContainerIntializers) in osgi? I was > hoping that the "cardinality:=multiple" attribute would have the > effect I want, but apparently not. > > thanks for any advice, > Jan > > > Jan Bartel <[email protected]> > www.webtide.com > 'Expert Jetty/CometD developer,production,operations advice' -- Jan Bartel <[email protected]> www.webtide.com 'Expert Jetty/CometD developer,production,operations advice'
