cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <>
Subject Re: WSProxyGenerator
Date Mon, 10 Feb 2003 23:09:30 GMT
On 10/2/03 21:00, "Tony Collen" <> wrote:

> On Mon, 10 Feb 2003, Nathaniel Alfred wrote:
>> Why not use plain old FileGenerator?  At least with 2.1's URLSource
>>    <map:generate type="file" src="http://backend/article?id=xyz"/>
>> works like a charm.  Am I missing something?
> The WSP also passes any POST or GET parameters to the remote host, which
> is something the FileGenerator does not do. Would it just make sense to
> put this feature into the FileGenerator as a <map:parameter/> ?

Ok, in my working copy (which I deleted this afternoon, promptly followed by
swearing in my native language going on for roughly 4 hours), the proxy
generator was configured in the following way:


    <!-- Map the HTTP proxy generator -->

    <map:generator name="proxy"

      <!-- This is the _base_ URL where requests will be made to.
           It is considered the "base" URL because it can be overridden
           at runtime in the pipeline configuration -->


      <!-- Method: right now it's only GET or POST -->


      <!-- Parameters defined within the "param" element can have multiple
           values, and will end up in the request body (in case of POST)
           or added to the query string (in case of GET) -->

      <param name="paramA" value="valueA1"/>
      <param name="paramA" value="valueA2"/>
      <param name="paramB" value="valueB1">

      <!-- Parameters defined within "query" elements will be configured
           exactly as the above "param", BUT in both cases (GET and POST)
           will end up in the query string -->

      <query name="queryX" value="valueX1"/>
      <query name="queryX" value="valueX2"/>
      <query name="queryY">


      <map:match pattern="test">

        <!-- Use the proxy generator defined above. Note, the src attribute
             will be relative to the URL declared in the configuration above
             (if any), while if it is an "absolute" URL, it will be used
             instead of the one above...  -->

        <map:generate type="proxy" src="./search">

          <!-- Parameters defined here override (or expand) the ones
               declared in the configuration above:

               - if the name starts with param:, the value will be added
                 to the values of the parameter defined above

               - if the name starts with param-overried:, the value will
                 override any value specified in the configuration above

               Same thing for query (starting with "query:" and/or

          <parameter name="param:q" value="{request-param:q}"/>

          <!-- Debug flag, instead of generating from the remote HTTP
               server, dump out a some sort of XML-ized kind of query we
               are going to do, since it might become complicated -->

          <parameter name="debug" value="false"/>

        <map:serialize type="xml"/>

I was planning to add support for headers as well, but at the end, I have to
rewrite the entire thing by tomorrow in the morning, so, those will come
later :-(


To unsubscribe, e-mail:
For additional commands, email:

View raw message