cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject Clarification Re: How to Call Servlets, CGIs on your server and other servers
Date Mon, 18 Sep 2000 21:56:50 GMT
I should make one thing clear - in the first method mentioned below, the 
servlet or CGI that you are calling is assumed to output well-formed XML, 
just as XML text - "as a string" if you want to call it that. Not as Java 
serialized objects or anything fancy like that, just ordinary XML! That 
should answer the question just asked.

Original message:

>A lot of people have asked about this recently. It's really SO SO simple
>(and it's going in the new FAQ which is effectively a rewrite).
>Unfortunately the 'answer' (or lack thereof) given in the current FAQ about
>"servlet chaining" is either very misleading or just plain wrong, I don't
>know which. Stefano?
>What you DON'T do is use ProducerFromRequest - that's a security risk, as
>noted in the recent Security Advisory which I can email to anyone who wants
>it (it's also in the mail archives).
>[A]. If the servlet or whatever you're calling returns XML, you can just do
>this: (If not see [B] below).
>1. Get the latest Cocoon from or just from CVS
>directly. 1.7.4 and below have a bug which prevents this from working.
>2. Make an XSP page like this:
><?cocoon-process type="xsp"?>
><xsp:page xmlns:xsp=""
>           xmlns:util="">
>  <util:include-uri href=""/>
>To build the URL dynamically just do something like this (if I remember
><util:href><xsp:expr>"" + request.
>getParameter ("foo")</xsp:expr></util:href>
>To include static XML files you can even use <util:include-file> (which is
>faster), but only if the file is on the filesystem(s) of your server. There
>are other options like XInclude and XML entities, but these should work
>[B] To get data from non-XML sources, just do like in any Java program:
>Object content = new URL ("").getContent ();
>or openStream(), or whatever is most appropriate (inside a Producer or
>preferably an XSP page). Read the Javadocs for Java - it pays dividends!
>To include static non-XML files which exist on your own server, it's faster
>to just do as A above but replace util:include-uri href= with
>util:get-file-contents name=

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

View raw message