You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Jan Bartel <ja...@intalio.com> on 2014/04/11 09:58:50 UTC

SpiFly and the header

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 <ja...@intalio.com>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'

Re: SpiFly and the header

Posted by David Bosschaert <da...@gmail.com>.
Yes, using resolution:=optional is the right approach here.

Best regards,

David

On 12 April 2014 00:35, Jan Bartel <ja...@intalio.com> wrote:
> Someone has pointed out that the resolution:=optional attribute solves
> my problem.
>
> thanks
> Jan
>
> On 11 April 2014 17:58, Jan Bartel <ja...@intalio.com> 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 <ja...@intalio.com>
>> www.webtide.com
>> 'Expert Jetty/CometD developer,production,operations advice'
>
>
>
> --
> Jan Bartel <ja...@intalio.com>
> www.webtide.com
> 'Expert Jetty/CometD developer,production,operations advice'

Re: SpiFly and the header

Posted by Jan Bartel <ja...@intalio.com>.
Someone has pointed out that the resolution:=optional attribute solves
my problem.

thanks
Jan

On 11 April 2014 17:58, Jan Bartel <ja...@intalio.com> 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 <ja...@intalio.com>
> www.webtide.com
> 'Expert Jetty/CometD developer,production,operations advice'



-- 
Jan Bartel <ja...@intalio.com>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'