You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Jain, Neeraj" <ne...@wincor-nixdorf.com> on 2004/10/22 06:33:58 UTC
specifying filename in map:read
Hi,
I am trying to download a file from server and I have following entry in
the sitemap for the same.
<map:match pattern="myURI*">
<map:act type="myURI-action">
<map:read src="{filename}" mime-type="application/dbexport"/>
<map:redirect-to uri="{result}"/>
</map:act>
<map:redirect-to
uri="cocoon:/main.html?title=error+in+myURI-action"/>
</map:match>
Now, I am able to get the file correctly but the "File Name" field in the
file download dialog is a random text. Is there is way to specify this field
from my myURI-action class?
Also the "Type" field is blank in the File Download dialog box. Can someone
please tell me how can I specify the filename here.
Thanks.
Re: specifying filename in map:read
Posted by Gunter D'Hondt <gu...@sofico.be>.
you should set the http header content-disposition; I don't know exactly
if that can be easily set in the sitemap but if that doesn't work you can
easily define an action that does it:
response.setHeader("Content-Disposition", "attachment;
filename=yourfile.extension;");
sometimes it also necessary to place a space between "content-" and
"disposition"
Gunter
"Jain, Neeraj" <ne...@wincor-nixdorf.com>
22-10-2004 06:33
Please respond to
users@cocoon.apache.org
To
"'users@cocoon.apache.org'" <us...@cocoon.apache.org>
cc
Subject
specifying filename in map:read
Hi,
I am trying to download a file from server and I have following entry
in the sitemap for the same.
<map:match pattern="myURI*">
<map:act type="myURI-action">
<map:read src="{filename}" mime-type="application/dbexport"/>
<map:redirect-to uri="{result}"/>
</map:act>
<map:redirect-to
uri="cocoon:/main.html?title=error+in+myURI-action"/>
</map:match>
Now, I am able to get the file correctly but the "File Name" field in the
file download dialog is a random text. Is there is way to specify this
field from my myURI-action class?
Also the "Type" field is blank in the File Download dialog box. Can
someone please tell me how can I specify the filename here.
Thanks.