Hi Michael, You have a interesting use case that I think we should discuss it if we should or not support. In short the answer to your question is that we did not plan such a support. But I'm willing to do it if we can find a safe way to implement it.
About problem 1 I there are more things involved: 1. Class path used to compile the JSPs. As right now the class path of the bundle that registered the jsps is used both for compilation and for finding TLDs. I consider this as working correct because this will work as for any servlet you have in a certain bundle where the servlet sees only it's own bundle class path. 2. Only one jsp registration per http context. As http context were not supposed to be shared between bundles (in pax web) the approach is correct. It depends then o what solution we choose for problem 2 (see bellow). If we chose 1. then nothing should be changed. If we chose 2 then it should allow more bundles to register jsps for the same http context and keep track of the bundle that did the registration in order that point 1. above still work. The problem 2 you described is certainly a bug that can have at least two solutions: 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. 2. we shutdown the servlet context corresponding to the http context (a 1:1 relation) only when it's usage count drops down to zero. Harder to implement then solution 1 but it does serve your use case. 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? Anyhow till we find a viable answer I'm going to implement a fix for problem 2 choosing solution 1: an http context can be registered only by one bundle. Alin On Sun, Feb 24, 2008 at 8:34 AM, Michael <[EMAIL PROTECTED]> wrote: > I'm working on a modular web application where different bundles contribute > servlets, JSPs, and resources to a single logical application. While the > bundles are generally independent with respect to the servlet context, there > are a handful of times where they need to share the servlet context. For > example, integration with third party libraries that expect a single servlet > context for the logical application. > > > I tried having one bundle create a custom HttpContext and then publishing > that HttpContext for use by other bundles. The idea being that all UI > bundles would register their servlets, JSPs, and resources with that > HttpContext. The custom HttpContext would search all bundles that make up > the logical application for resources instead of just searching the bundle > that created the HttpContext. But I've run in to a few problems: > > (1) Only JSPs provided by the first bundle that registered are found. It > looks like HttpServiceStart#registerJsps only allows a single JSP > registration per HttpContext. This would be okay given a registration for > *.jsp, but the JasperServlet is initialized with the classloader from the > first bundle to register. > > (2) When shutting down a bundle, the HttpContext is removed from the > ServerController (HttpServiceStarted#stop), even if other bundles are still > active and using the same HttpContext. > > Is sharing an HttpContext across bundles allowed by the compendium > specification? I didn't see any specific requirements that prohibit it but > I very easily may have missed something. > > Assuming that sharing an HttpContext across bundles is allowed by the > specification, is this something that Pax Web Service and Pax Web JSP will > support in the future? > > Thanks, > Michael > _______________________________________________ > general mailing list > general@lists.ops4j.org > http://lists.ops4j.org/mailman/listinfo/general > > _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general