> <snip />
>
> So, what I want to do is very basic:
>
> First, I want to generate the internal file name using xQuery, given
> the virtual path and the virtual file name. At the same time I check
> whether the image is live ,and whether the particular user should be
> allowed to view it.
> Then, I want to call a different (internal) pipeline using the
> resulting file name (embedded in the <file></file> tag) (for instance
> 44400.jpg) as the request, and return the result of that pipeline.
>
> Any ideas now of how I can achieve that?


So to step back a bit, ignoring the XQuery/eXist details, what you really
are looking for is a way to set the src of a map:read by retrieving it
from an XML file, correct?

In Cocoon's sitemap processing, once the pipeline has been set up it
cannot be altered; in other words the contents of the XML stream cannot
affect the configuration of the pipeline components that are used. 
Therefore the only way you can set the reader src is to do it while the
pipeline is being set up, before the SAX stream starts.  This is done by
matchers, selectors, or actions, with the help of input modules.

So what you probably need is a custom action that examines the meta XML
file, extracts the proper image id from it, and passes that value along to
the reader.  The sitemap for this might look something like this (this is
from memory, so it may be a bit off; you'll want to check the docs.):

<map:match pattern="*/*/*.jpg">
  <map:act type="get-image-id">
    <map:parameter name="xquery" value="xq/{1}.xq" />
    <map:parameter name="file" value="{1}/{2}/{3}" />
    <map:read src="blahblah/{imageId}.jpg" ... />
  </map:act>
  <map:read src="failureimage.jpg" />
</map:match>

The get-image-id action class would take the parameters and use them to
get the proper image id from the xml file via xquery.  It would then
return that image id in the Map object with a key "imageId", so that the
nested map:read has access to it as {imageId}.

If the image id request fails, due to insufficient permissions or other
conditions handled in the action logic, it would return null, which causes
the nested map:read to be ignored and the other map:read would be executed
instead to deliver the failure image to the client.

Another approach might be to use flowscript; the image-id extraction logic
would be coded in the flowscript and it would then sendPage() to an
internal pipeline with that id in its URI.

Does this help at all?
--Jason



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to