>>>>> Grzegorz Grzybek <
gr.grzybek-Re5JQ...@public.gmane.org>:
>> Will it be possible to get a ServletContext OSGi service injected into a
>> @Reference, when using the web whiteboard of OSGi 7?
>>
> Sure - it's described in 128.3.4 Publishing the Servlet Context chapter of
> CMPN specification and I think it should already be a case (at least that's
> what I remember from JBoss Fuse (based on Karaf)).
Thanks Grzegorz!
I've been successful in injecting the service, but not in filtering to
get the right service.
I got injections in this variant:
@Reference
public void setServletContext(ServletContext context) {
this.context = context;
}
But I got no injections in:
@Reference(target = "(osgi.web.symbolicname=authservice)")
public void setServletContext(ServletContext context) {
this.context = context;
}
And I got no injections in:
@Reference(target = "(osgi.web.contextpath=/authservice)")
public void setServletContext(ServletContext context) {
this.context = context;
}
The ServletContextHelper creating the context, is:
@Component(
property= {
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME+"=authservice",
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH+"=/authservice"},
service=ServletContextHelper.class,
immediate=true
)
public class AuthserviceServletContextHelper extends ServletContextHelper { }
> About actual Whiteboard R7 annotations - support for those has yet to be
> added to Pax Web.
Looking forward to this happening.
Thanks again!