>>>>> lenny-5o6p1tln9c5dpfhejli...@public.gmane.org:

> Hi,
> The magic is explained in the documentation towards the bottom, but I think 
> you already know that:
> // register the Shiro Feature
> classes.add(ShiroFeature.class);

Yes.  But that doesn't help me much.

I'm using an OSGi Web Whiteboard component
 
https://github.com/steinarb/oldalbum/blob/e8dbf374c6132694f0ad7c0d4026def355d5514e/oldalbum.web.api/src/main/java/no/priv/bang/oldalbum/web/api/OldAlbumWebApiServlet.java#L33

that derives from JerseyServlet, which is written by me:
 
https://github.com/steinarb/servlet/blob/9cce8e033e63a23585ddb868e5af5ec2a1ba9be0/servlet/servlet.jersey/src/main/java/no/priv/bang/servlet/jersey/JerseyServlet.java#L48

which in turn derives from the Jersey ServletContainer class, and in the
init() method adds injected OSGi services to the HK2 dependency
injection container, so that they can be injected into JAX-RS resource
classes:
 
https://github.com/steinarb/servlet/blob/9cce8e033e63a23585ddb868e5af5ec2a1ba9be0/servlet/servlet.jersey/src/main/java/no/priv/bang/servlet/jersey/JerseyServlet.java#L85

I have written this myself and figured I had a pretty good handle on how
stuff is handled, but the JAX-RS Application and the
Application.getClasses() methods are new to me.

> This hooks up into Jax-RS Provider mechanism, and that’s what scans
> the annotations.  I believe it’s supposed to work transparently with
> Karaf and OSGi, but I am not an expert in those.

Hm... the Application has no role that I can see if one uses the Web
Whiteboard...?

Or does it?

(Note that my self-written JerseyServlet predates the OSGi JAX-RS
Whiteboard specification, or at least: predates the OSGi JAX-RS
Whiteboard implementation in karaf, and I've never felt the urge to move
there, because I currently control what jersey version I'm using and
what jackson version I'm using, and those are newer than the ones
currently shipped with karaf. So even if karaf itself supports
shiro-jaxrs I won't be able to use it. But if I can figure out where and
how it supports it, I may be able to repeat it)

Reply via email to