On Tue, Oct 20, 2009 at 2:26 PM, Filippo Diotalevi <
[email protected]> wrote:

> On Tue, Oct 20, 2009 at 9:34 AM, Thomas Joseph <[email protected]>
> wrote:
> > Filippo,
> >
> > You are on an interesting task. IIRC, few months back, you were on search
> > for a best web framework for OSGi. Looks like you settled with Spring
> MVC.
> > [...]
>
> Hi Thomas, I didn't really settled with Spring MVC, but I saw some
> interest in developing Spring MVC applications in an OSGi environment,
> so I started looking at it.
> It turned out that, while it is true that Spring MVC "supports" OSGi,
> as "Modular Java" and "Pro Spring DM" demonstrate, it is at the moment
> not possible to build real modular web applications with it (unless
> you mean "modular as long all your controllers and jsps are in one
> module").
>
> The Spring MVC controller part is quite easy to modularize (as I
> explained in the first email). However, the view resolution part
> (using JSPs) is not. Looking into the Spring code, it turns out that,
> at the end of the day, Spring only does a
> getRequestDispatcher(url).forward(..), so if the URL contains a
> resource of another bundle, it does not work.
>

Yes, that is true. But since you are using Spring , it would be worthwhile
to mention that I had to override the few Spring classes including
DispacherServlet. But don't know if that is required for Spring MVC. Hope,
not..

Basically, I had to do the following few steps to make it work:
1.  You need to have a bundle (call it web-core) that will be initialised
and listneing for other "web-module"/slice bundles, that can coomunicate
with Whiteboard pattern.
2. web-core will maintain a dynamic list of the slice bundles (references to
the bundle contexts)
3. Implement org.osgi.service.http.HttpContext  such that whenever a
resource request is made, you get its call. This is where you can query your
slice bundles, to retrieve the required resource.

The step #3 should be looked in for an excellent algorithm that can keep a
list of bundles + query the resources (you may intelligently cache them!)

I wish, I could share the code, but I cannot : (, but let me know if you
need any help with this. I would be happy to spend some time too, if you
could do your work in your lab or other location you like.

I have a long wish to work on making a project that can work on the
web-modules concept, for any web framework (even before the "Slices"),  so
if this is a starting,.. we can call it Pax-Bunny (Alin's next magical
project name :) )


> I'm pretty stuck on this point, but I'm wondering if the situation
> would be different using another rendering technology like Velocity or
> Freemarker, which are by construction more "embeddable" than jsps.
> I'll do a few tests this afternoon.
>
>
> --
> Filippo Diotalevi
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>



-- 
-- 
Thanks and Regards,
/Thomas Joseph

LinkedIn: http://www.linkedin.com/in/ethomasjoseph
Twitter: http://twitter.com/ethomasjoseph
Blog: http://openthoughtworks.blogspot.com

------------------------------------------------------------
Promote Open Source - Promote Liberty of Ideas and Software.
------------------------------------------------------------
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to