速度 - 哪种架构具有灵活性?
我正在使用 Spring(用 ROO 搭建脚手架)和 Velocity 作为模板引擎来构建 Web 应用程序。
这些应用程序的流程非常相似,大多数时候逻辑变化不大,因此我可以在多个 Web 应用程序中使用相同的控制器。需要定制的是UI端。
我想构建一个灵活系统,允许:
- 在开发时在本地工作
- 将模板打包到 web 应用程序之外
- 更改某些模板而不重新部署 web 应用程序。
到目前为止,我已经构建了一些使用 WebappResourceLoader 和 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
所以基本上,“默认”模板位于 web 应用程序内部,并且可以被位于某处的模板覆盖可通过 URL 访问(现在位于 Apache 中的一个简单文件夹中)。
最后,每个“皮肤”的模板应该打包在一个单独的 WAR 中。
现在我不知道如何能够在本地使用此架构...
大多数时候,我将致力于自定义模板代码,所以我想我可能会发生 WAR仅包含模板的项目,并使用 Maven 的 WAR Overlay 使它们栩栩如生。
但在这种情况下,模板位于 WAR 内,这不是我想要的......
有什么想法吗?
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 :
- To work locally while developing
- To package templates outside of the webapp
- 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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论