>>>>> Steinar Bang <[email protected]>:

> The handler for the ServletContextHelper service seems to do stuff with
> both HTTP_WHITEBOARD_CONTEXT_NAME and HTTP_WHITEBOARD_CONTEXT_PATH, but
> I havn't yet determined how it works and how to connect things to a
> servlet, and (hopefully also) a Filter.

Ok, now I've got it working[1].

The changes are:
 1. Added a ServletContextHelper OSGi component[2] whose only purpose is
    to add an OSGi service that has a service attribute named
    HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH
    (ie. "osgi.http.whiteboard.context.path") with the value of the web
    applications context path
 2. Changed the servlet pattern of the servlet component, and added a
    property HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT
    (ie. "osgi.http.whiteboard.context.select") containing a select
    expression that will find the ServletContextHelper[3]
 3. Made the same changes for the Shiro filter component as for the
    servlet component (change the URL pattern to "/*" and add an
    expression that will find the ServletContextHelper)[4]

I found an example of how to do this in the blog article "Http
Whiteboard – Simply Simple – Part II"[5]

Another blog article with some useful clues (but with an approach that
doesn't currently work on the Pax Web Whiteboard Extender), is "Access
OSGi Services via web interface"[6].


References:
[1] 
<https://github.com/steinarb/ukelonn/commit/b1cece3ff166d62e5eb52ec8b5c51d2304025c2f>
[2] 
<https://github.com/steinarb/ukelonn/blob/b1cece3ff166d62e5eb52ec8b5c51d2304025c2f/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnServletContextHelper.java#L6>
[3] 
<https://github.com/steinarb/ukelonn/blob/b1cece3ff166d62e5eb52ec8b5c51d2304025c2f/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnServlet.java#L39>
[4] 
<https://github.com/steinarb/ukelonn/blob/b1cece3ff166d62e5eb52ec8b5c51d2304025c2f/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnShiroFilter.java#L41>
[5] <https://blog.osoco.de/2016/09/http-whiteboard-simply-simple-part-ii/>
[6] <http://blog.vogella.com/2017/04/20/access-osgi-services-via-web-interface/>

-- 
-- 
------------------
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to