I'm going to have a single site that needs to be themed a number of ways. I want to pull the theme information from a database to save from having to redeploy every time a new theme is needed. I read you can create a custom ThemeSource implementation but was unsure how to implement a database driven theme source. Anyone have experience with this in Spring MVC?
It's simple.
Spring Controller, no filter - controllers are easier to wire-up.
Make the theme simple (one css file, one js file, a couple of images) it will help.
Create a theme and themeresource table in the database. theme contains theme_id, theme_name, theme_description. themeresource contains resource_id, theme_id, name, content(blob). (I'd use Hibernate)
Create a DAO for theme access (I'd use Hibernate)
Create a controller called ThemeController. Map it to "/theme/resources".
In the controller read the request, see what file it's requesting(ex: "/theme/resources/style.css").
You already know what theme is required because of the ThemeResolver
Serve the "style.css" file (and all other files) from the database by querying the DAO with the theme and the resource name
Another option would be to create a listener/filter that does exactly what the above controller should do.