mexique1
mexique1

Reputation: 1693

velocity - which artitecture for flexibility?

I'm building web applications using Spring (scaffolded with ROO) and Velocity for the template engine.

Those applications are very similar in their flow, most of the time the logic doesn't change very much, so I can use the same controllers across multiple webapps. What needs customization is the UI side.

I want to build a flexible system that allows :

  1. To work locally while developing
  2. To package templates outside of the webapp
  3. To change some templates without redeploying the webapp.

So far I have built something which uses the WebappResourceLoader and the URLResourceLoader :

resource.loader=url,webapp

webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader
webapp.resource.loader.path=/WEB-INF/views/
webapp.resource.loader.cache=true
webapp.resource.loader.modificationCheckInterval=1

url.resource.loader.class=org.apache.velocity.runtime.resource.loader.URLResourceLoader
url.resource.loader.root=http://localhost/templates/
url.resource.loader.cache=false

So basically, the "default" templates are located inside the webapp, and can be overridden by templates located somewhere accessible by URL (right now in a simple folder in Apache).

In the end, the templates for each "skin" should be packaged in a separate WAR.

Now I don't know how to be able to work locally with this architecture...

Most of the time, I'll be working on customizing the templates code, so I suppose I could have a WAR project with only templates, and use Maven's WAR Overlay to bring them to life.

But in this case, the templates are inside the WAR, and this is not what I want...

Any ideas ?

Upvotes: 1

Views: 285

Answers (0)

Related Questions