Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to modularize a JSF/Facelets/Spring application with OSGi?
How to modularize a JSF/Facelets/Spring application with OSGi? [message #525526] Tue, 06 April 2010 18:51
Aleksei Valikov is currently offline Aleksei ValikovFriend
Messages: 1
Registered: April 2010
Junior Member
Hi,

I hope you forgive me for reposting my question from stackoverflow.


I'm working with very large JSF/Facelets applications which use Spring for DI/bean management. My applications have modular structure and I'm currently looking for approaches to standardize the modularization.

My goal is to compose a web application from a number of modules (possibly depending on each other). Each module may contain the following:

* Classes;
* Static resources (images, CSS, scripts);
* Facelet templates;
* Managed beans - Spring application contexts, with request, session and application-scoped beans (alternative is JSF managed beans);
* Servlet API stuff - servlets, filters, listeners (this is optional).

What I'd like to avoid (almost at all costs) is the need to copy or extract module resources (like Facelets templates) to the WAR or to extend the web.xml for module's servlets, filters, etc. It must be enough to add the module (JAR, bundle, artifact, ...) to the web application (WEB-INF/lib, bundles, plugins, ...) to extend the web application with this module.

Currently I solve this task with a custom modularization solution which is heavily based on using classpath resources:

* Special resources servlet serves static resources from classpath resources (JARs).
* Special Facelets resource resolver allows loading Facelet templates from classpath resources.
* Spring loads application contexts via the pattern classpath*:com/acme/foo/module/applicationContext.xml - this loads application contexts defined in module JARs.
* Finally, a pair of delegating servlets and filters delegate request processing to the servlets and filters configured in Spring application contexts from modules.

Last days I read a lot about OSGi and I was considering, how (and if) I could use OSGi as a standardized modularization approach. I was thinking about how individual tasks could be solved with OSGi:

* Static resources - OSGi bundles which want to export static resources register a ResourceLoader instances with the bundle context. A central ResourceServlet uses these resource loaders to load resources from bundles.
* Facelet templates - similar to above, a central ResourceResolver uses services registered by bundles.
* Managed beans - I have no idea how to use an expression like #{myBean.property} if myBean is defined in one of the bundles.
* Servlet API stuff - use something like WebExtender/Pax Web to register servlets, filters and so on.

My questions are:

* Am I inventing a bicycle here? Are there standard solutions for that? I've found a mentioning of Spring Slices but could not find much documentation about it.
* Do you think OSGi is the right technology for the described task?
* Is my sketch of OSGI application more or less correct?
* How should managed beans (especially request/session scope) be handled?

I'd be generally grateful for your comments.

Previous Topic:Best way to trigger the confapply command?
Next Topic:[Enhancement] Please improve Exceptions to show more detail when it occur ClassNotFoundException.
Goto Forum:
  


Current Time: Mon Nov 24 02:53:02 GMT 2014

Powered by FUDForum. Page generated in 0.02066 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software