Hi Alin, > 1. we do not allow an http context to be registered by more bundles. > Simple to implement, blocks your use case, but not really. What you > could do is that you could register an http context that delegates to > your shared between bundles context. Right away I see a disadvantage > of not being possible to share servlet context attributes between > bundles. Do yo need that? If yes I may come up with a solution where > if your registered http context implements a custom interface that can > set/get attributes, then attributes handling will be delegated to http > context and you can further delegate to the shared context.
Specifically, I need the bundles to share the HttpSession and the ability to forward from a servlet in one bundle to a servlet/JSP in another. I could delegate to a shared HttpContext but that only helps with resource loading if I'm not mistaken. Each bundle would still have its own ServletContext and hence, my two use cases aren't satisfied. > Now your use case. Let me know that I understood correctly that you > basically want to share a servlet context between more bundles and you > want to do so by sharing the http context between those bundles, http > context that acts as a composite context by being able to load > resources from bundles that share the same http context. Correct? > Yep, that's what I'd like to do. Ultimately, I want a single servlet context for all of my application bundles. Shared HttpSession, forwards, attributes, etc. My current work around is to write an extender bundle that is responsible for registering all servlets and JSPs. It will discover the servlets and JSPs that my application bundles provide and then register them with the WebContainer. I'll have to write a custom HttpContext that knows how to load resources from the discovered bundles. One disadvantage to this approach is that JSP TLDs will have to be in the extender bundle, not the application bundles. If the JSP support searched imported packages for TLDs, I could avoid that. Is there a simpler way to share a ServletContext across bundles? Thanks, Michael
_______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general