Hi all,
I¹m trying to include the ³theme² feature in one of my projects. I was
wondering which approach is the best.
In JSF2, as we all know, we got the Resource Feature, where you can define a
resource using library, locale, resourceName and so. Imagine that I got the
follow resource: cpt-components/tab.css that can be retrieved by the page
author using the follow:
#{resource[Œcpt-components:tab.css¹]}
So when this resource is being asked I need to get the current theme of my
application (database, or whatever, lets says that the current theme is
Œdefault¹). My resources are organized using the follow pattern:
cpt-resources.jar
- META-INF/resources/cpt-components/default/tab.css
- META-INF/resources/cpt-components/new_year/tab.css
How to do that?
- I could create a ResourceHandlerImpl (or ResourceManager?), so when a
resource is being asked, I can add the ³/theme_name/² path before the
resourceName and, I think, everything will work. In this approach, how can I
override the default Sun ResourceHandler Impl? ( I searched for all
possibilities on web.xml reading the source of class WebConfiguration and my
best guess would be ³facelets.RESOURCE_RESOLVER² but I don't know.)
- I could design some event-based model to threat the themes resources
before encoding them, using Application Listeners.
What is the best implementation for theme feature?
Thanks in advance.