Hello,

I want to have a filter at the root of my application where all http
requests must pass through, so I make a Servlet filter:
@Component(
service=Filter.class,
scope=ServiceScope.PROTOTYPE,
property= {
"osgi.http.whiteboard.filter.name=AuthenticationFilter",
"osgi.http.whiteboard.filter.pattern=/*",
"service.ranking:Integer=10"
}
)
public final class AuthenticationFilter implements Filter {...}
-----------------------------
Then I have some servlets (in other bundles) defined like this:
@Component(
service = Servlet.class,
property= {
"osgi.http.whiteboard.servlet.pattern=/token"
}
)
public class AccessTokenServlet extends HttpServlet{...}
-------------------------------
I also have some resource services in other bundles:
@Component(service = IconsResourceService.class,
property = {
"osgi.http.whiteboard.resource.pattern=/static/icons/*",
"osgi.http.whiteboard.resource.prefix=/icons"
}
)
public class IconsResourceService {}
-----------------------
However, my filter never trigger when i request the icon (static resource)
or token (servlet). My understanding is that the 3 components above reside
in different bundles thus they have different servlet contexts so the
filter wont trigger. I can created a ServletContextHelper and select it in
the Servlet component annotation but this wont help in the case of the
resource service. Is there other way to share filter across bundles?

Thai
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to