cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: can reader read external url?
Date Tue, 30 Sep 2003 10:48:09 GMT
Tsui, Alban wrote:

> I want to set up a pipeline so that the reader will read in an url as 
> svg and then it immediately pipes out bmp, for example:
>
> <!-- the query string parameter for url is simply an url path to a svg 
> image -->
>                         <map:match pattern="*/svg2bmp?url=**">
>                                 <map:read src="{2}" mime-type="svg+xml"/>
>                                 <map:serialize type="svg2jpeg"/>
>                         </map:match>
>
>
> I tried but it didn't seem to work.
>
> Have I done something wrong? Or can the reader read "src" as url? Can 
> someone suggest a solution?
>

A reader is a kind of complete pipeline on its own, targeted a directly 
providing binary content without involving any XML processing. So 
processing of the sitemap above stops at <map:read> (the svg is sent 
verbatim to the browser) and <map:serialize> is never reached.

> Alternative I need to write a xsp generator read the url xml/svg and 
> then having a transform just copy the content from the root tag 
> generated from the xsp and then put it through the svg2jpeg serialize 
> step.... yuk.
>

Wow, how complicated ! You just need the (default) file generator. And 
you can't match on a request parameter (the ?url=**), but use it in the 
pipeline :
<map:match pattern="*/svg2bmp">
  <map:generate src="{request-param:url}"/>
  <map:serialize type="svg2jpeg"/>
</map:match>

Now I personally prefer to use non-parameterized URIs when it makes sense:
<map:match pattern="*/svg2bmp/**.jpeg">
  <map:generate src="{2}.svg"/>
  <map:serialize type="svg2jpeg"/>
</map:match>

Hope this helps !

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



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


Mime
View raw message