[opencms-dev] filter-mapping for file included by <cms:include>?

Markus Grabner grabner at icg.tugraz.at
Sat Feb 21 21:41:53 CET 2009


	Hi!

    What is the recommended configuration to apply a filter-mapping (in 
web.xml) to arbitrary files included by <cms:include> from JSP files? I'm 
trying to integrate ZK (see http://www.zkoss.org) with opencms and include 
ZUL-files in JSP-pages, i.e., something like

<cms:include page="test.zul" />

I guess setting up a correct filter mapping should do the trick, but wasn't 
able to find a reasonable solution. I tried the following:

*) I read "http://mail.opencms.org/pipermail/opencms-dev/2006q4/027017.html", 
there were several suggestions, but no working solution.

*) I set <url-pattern> in <filter-mapping> to the file extension ("*.zul"). 
However, this only works when the ZUL-file is accessed directly, but not for 
<cms:include>ing the file in a JSP file.

*) When the ZUL-file is included by <jsp:include> instead of <cms:include>, 
and I make sure that it exists at the correct path in the real file system, 
the filter-mapping works. However, this is obviously not a viable solution 
for a production environment.

*) I also considered a static export, but there is only a single version of 
the file instead of separate online and offline versions, so this is also not 
useful for this purpose.

*) From the opencms log file I concluded that the external request dispatcher 
is only invoked for files included by <jsp:include> and for JSP-files 
included by <cms:include>, but not for non-JSP files included by 
<cms:include>. So I tried to make false claims about the ZUL-file and 
declared it as JSP by explicitly overriding its type in the opencms explorer. 
However, then the extension "jsp" is added to the file, and for whatever 
reason a <url-pattern> "*.zul.jsp" doesn't work.

*) This led me to a workable, but *very ugly* solution: storing all ZUL-files 
(with type set to JSP) under /test/zul in the VFS and defining two separate 
path-based filter mappings with the following <url-pattern>s

/WEB-INF/jsp/offline/sites/default/test/zul/*
/WEB-INF/jsp/online/sites/default/test/zul/*

gives the desired result. However, this calls for troubles with maintenance 
since all paths to ZUL files must explicitly be listed in web.xml, and all 
ZUL files must be tagged as JSP.

So the short question after the long story is: how can I configure opencms to 
invoke the external request dispatcher for non-JSP files included by 
<cms:include> in a similar way as it is done for JSP-files?

	Thanks & kind regards,
		Markus


-- 
Markus Grabner - Computer Graphics and Vision
Graz University of Technology, Inffeldgasse 16a/II, 8010 Graz, Austria
Phone: +43/316/873-5041, Fax: +43/316/873-5050
WWW: http://www.icg.tugraz.at/Members/grabner



More information about the opencms-dev mailing list