You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by James Cummings <Ja...@computing-services.oxford.ac.uk> on 2004/01/20 17:18:21 UTC

allowing non-dynamic downloads.

Hi there,

I've got a bit of a sitemap.xmap that currently looks like:

<map:match pattern="downloads">
   <map:generate src="downloads/downloads.xml"/>
   <map:transform type="xalan" src="style/xsl/add-includes.xsl"/>
   <map:serialize type="html"/>
</map:match>

Now from this page of downloads there will be links to some
downloads in a variety of formats (zip/tgz/pdf).  All of these
are preprocessed and I don't want to use the zip serializer to
assemble a zip file on the fly or anything like that.

How do I allow the user to have any file under this sent to
them?  I just want it to be a normal html link like
<a href="foo.tgz">Foo</a> and foo.tgz to be passed through
in the same way it does if I had it outside of cocoon.

So maybe something like:
  <map:match pattern="downloads/*">
   <map:generate src="downloads/*"/>
   <map:serialize type="????" />
  </map:match>

But what do I serialize it as?  I don't want to have separate rules
for each of the possible file types, and they are going to be
pre-cooked and sat there in the downloads/ directory.

Suggestions?

-James


---
Dr James Cummings, Oxford Text Archive, James.Cummings@ota.ahds.ac.uk

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


Re: allowing non-dynamic downloads.

Posted by Jorg Heymans <jh...@domek.be>.
the Serializer has a method getMimeType(), this method is called during 
pipeline setup IIRC so there is no way of setting it dynamically 
afterwards (if anyone says it is please let me know!).


If your files have the correct extension then it is likely that the 
browser will do the right thing when you open it, however not guaranteed.

it would be nice if you could do something like

<map:match pattern="downloads/*.*">
    <map:generate src="downloads/*.*"/>
    <map:serialize type="{2}" />
</map:match>

Maybe create a generic serializer with mimetype application/octet-stream?

HTH
Jorg

James Cummings wrote:

> Hi there,
> 
> I've got a bit of a sitemap.xmap that currently looks like:
> 
> <map:match pattern="downloads">
>    <map:generate src="downloads/downloads.xml"/>
>    <map:transform type="xalan" src="style/xsl/add-includes.xsl"/>
>    <map:serialize type="html"/>
> </map:match>
> 
> Now from this page of downloads there will be links to some
> downloads in a variety of formats (zip/tgz/pdf).  All of these
> are preprocessed and I don't want to use the zip serializer to
> assemble a zip file on the fly or anything like that.
> 
> How do I allow the user to have any file under this sent to
> them?  I just want it to be a normal html link like
> <a href="foo.tgz">Foo</a> and foo.tgz to be passed through
> in the same way it does if I had it outside of cocoon.
> 
> So maybe something like:
>   <map:match pattern="downloads/*">
>    <map:generate src="downloads/*"/>
>    <map:serialize type="????" />
>   </map:match>
> 
> But what do I serialize it as?  I don't want to have separate rules
> for each of the possible file types, and they are going to be
> pre-cooked and sat there in the downloads/ directory.
> 
> Suggestions?
> 
> -James
> 
> 
> ---
> Dr James Cummings, Oxford Text Archive, James.Cummings@ota.ahds.ac.uk


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


Re: allowing non-dynamic downloads.

Posted by Andrew Savory <an...@luminas.co.uk>.
Greetings Doctor Cummings,

On 20 Jan 2004, at 16:18, James Cummings wrote:

> Now from this page of downloads there will be links to some
> downloads in a variety of formats (zip/tgz/pdf).  All of these
> are preprocessed and I don't want to use the zip serializer to
> assemble a zip file on the fly or anything like that.
>
> How do I allow the user to have any file under this sent to
> them?  I just want it to be a normal html link like
> <a href="foo.tgz">Foo</a> and foo.tgz to be passed through
> in the same way it does if I had it outside of cocoon.

You need to set up entries for the various file extensions:

<map:match pattern="downloads/*.pdf">
	<map:read src="resources/pdf/{1}.pdf"/>
</map:match>

You can optionally add a MIME type:

<map:match pattern="downloads/*.zip">
	<map:read src="resources/zip/{1}.zip" mime-type="application/zip"/>
</map:match>

> But what do I serialize it as?  I don't want to have separate rules
> for each of the possible file types, and they are going to be
> pre-cooked and sat there in the downloads/ directory.

No serializing, just passing through. You *could* do a generic matcher, 
but you'd probably want to use the regexp matcher for that:

<map:match type="regexp" pattern="some pattern here that splits on '.' 
and places content in {1}.{2}">
	<map:read src="resources/{2}/{1}.{2}"/>
</map:match>

hope that helps!


Andrew.

--
Andrew Savory, Managing Director, Luminas Limited
Tel: +44 (0)870 741 6658  Fax: +44 (0)700 598 1135
Web: http://www.luminas.co.uk/
Orixo alliance: http://www.orixo.com/


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