Revision history [back]

click to hide/show revision 1
initial version

asked 2019-03-30 04:05:33 +0800

jgomer2001 gravatar image jgomer2001

Serving zul files from a directory outside web application

I am wondering if it is possible to place zul files outside the web application folder or war file.

I would like to have my ViewModels and supporting classes as normally in WEB-INF/classes but certain zul files in a separate external location so I could, for instance, add some zul files on the fly.

In JSF this can be achieved by using javax.faces.view.facelets.ResourceResolver or javax.faces.application.ResourceHandler...

Any insight is highly appreciated. I was navigating the docs, especially ZK config reference manual 8.5.1 but didn't seem to find a fit. I'm wondering about org.zkoss.zk.ui.util.URIInterceptor

Ideally I would like to solve the problem declarively.

Serving zul files from a directory outside web application

I am wondering if it is possible to place zul files outside the web application folder or war file.

I would like to have my ViewModels and supporting classes as normally in WEB-INF/classes but certain zul files in a separate external location so I could, for instance, add some zul files on the fly.

In JSF this can be achieved by using javax.faces.view.facelets.ResourceResolver or javax.faces.application.ResourceHandler...

Any insight is highly appreciated. I was navigating the docs, especially ZK config reference manual 8.5.1 but didn't seem to find a fit. I'm wondering about org.zkoss.zk.ui.util.URIInterceptor

Ideally I would like to solve the problem declarively.


This is for production use. I have an application where plugins can be added at runtime. This works pretty well. In plugins, developers can bundle zul files...

I use jetty so app's .war ends up extracted to a random temp directory. By using servletContext.getRealPath("/") I know this physical path, so I simply extract the files there. That way, zul files are served with no effort

The problem arises in a clustered environment (same app running at different nodes), because the temp path is not the same across all nodes, so I need to use a predefined location to place zul files.

Thanks for reading!

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More