>>>>> Grzegorz Grzybek <[email protected]>:

>> 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!

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/86zhc8t1ji.fsf%40dod.no.

Reply via email to