OSGi - How mature is this technology?

前端 未结 4 2074
离开以前
离开以前 2021-01-31 21:10

I have a requirement where I need to share some web resources (jsp, html, js, images, css etc.) across different

4条回答
  •  清歌不尽
    2021-01-31 21:49

    I'm not overly familiar with Struts (or Spring MVC, for that matter), but you might look at the SpringSource dm Server. It is based on Equinox, the OSGi container used by Eclipse, and a bundlized Apache Tomcat (as well as the Spring framework stuff).

    With the SpringSource server, each war file is deployed more or less traditionally, but can access resources (classes, services, etc.) via the normal OSGi mechanisms. Those mechanisms are based around the OSGi bundle's classloaders, which might be problematic for sharing file resources like jsps, html, css, and so on. It might work if you had something similar to the DefaultServlet that rendered things from the classloader rather than the file system. (Or, heck, I might be making this more complicated than I need to.)

    On the other hand, you could deploy everything as independent web applications and stitch it all together at the client end.

    The first answer to the modular web apps question looks really interesting, although not directly applicable to the SpringSource server, since it does not provide the OSGi HttpService. I believe the recent OSGi 4.2 enterprise spec work is heading towards the SpringSource server's deploy-war-files-as-OSGi-bundles approach, as well.

    In answer to your EDIT 2 question, if I understand it correctly, the "web context" in that answer would be built dynamically using the HttpService, which is an interface that supplies methods to

    1. register servlets under URLs, and

    2. register resources (files, etc.) under URLs.

    Since those operations are handled dynamically, there wouldn't need to be anything explicitly merging web context bits.

提交回复
热议问题