cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <p...@betaversion.org>
Subject Re: WSProxyGenerator
Date Mon, 10 Feb 2003 23:09:30 GMT
On 10/2/03 21:00, "Tony Collen" <tcollen@neuagency.com> 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:generators>

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

    <map:generator name="proxy"
        label="content,data"
        src="org/betaversion/cocoon/components/proxy/HttpProxyGenerator"
        logger="sitemap.generator.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 -->

      <url>http://wwwp.overture.com/d/search/p/partner/xml/2.3.2/</url>

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

      <method>POST</method>

      <!-- 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">
        <value>valueB2</value>
        <value>valueB3</value>
      </param>

      <!-- 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">
        <value>valueY1</value>
        <value>valueY2</value>
      </param>
    </map:generator>
  </map:generators>

  [...]

  <map:pipelines>
    <map:pipeline>
      <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
               "query-override:".

          <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:generate>
        <map:serialize type="xml"/>
      </map:match>

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 :-(

    Pier


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message