[opencms-dev] OpenCms and ZK

Christoph Schönfeld cschoenfeld at sylphen.com
Mon Nov 20 15:24:04 CET 2006


Right, my last suggestion was invalid. It is impossible to have URLs 
like "http://localhost:8080/opencms/yourfile.zul" getting processed by 
the ZK servlet if you do not disable the OpenCms servlet. The reason is 
that "/opencms/*" maps to the OpenCms servlet already. All requests to 
URLs starting with "http://localhost:8080/opencms/" are processed by the 
OpenCms servlet.

Even if it were possible to remap a subset like /opencms/*.zul to a 
different servlet it wouldn't work because the ZUL files are not on 
disk, they are in the OpenCms VFS in the database.

Option A:
Store your *.zul files outside of OpenCms.

The mapping would be "/zul/*" and URLs would be 
"http://localhost:8080/opencms/zul/yourfile.zul" (OpenCms urls would be 
"http://localhost:8080/opencms/opencms/...").

Option B:
You could also write a wrapper JSP which takes the ZUL file VFS path as 
a parameter, retrieves it using the OpenCms API and passes it to the ZK 
processor. The URLs would then be 
http://localhost:8080/opencms/zkwrapper.jsp?path=yourfile.zul.

Option C:
Write a Servlet filter and apply it to the opencms servlet mapping. The 
filter will be called before the OpenCms servlet. If your filter sees 
that the request ends with ".zul" you should then cache the OpenCms 
response which is the ZUL file and run the ZK processor on it.

Option C is mor elegant than B. But A is definitely the easiest to do 
because you do not have to write code for it. However, you lose the 
ability to store the ZUL files in VFS.

Any other ideas?


Best regards,
Christoph



More information about the opencms-dev mailing list