cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gunter D'Hondt <gunter.dho...@sofico.be>
Subject RE: specifying filename in map:read
Date Mon, 25 Oct 2004 09:52:15 GMT
but try to change the file extension in the matcher pattern; something 
like this:

      <map:match pattern="*.txt">
              <map:act type="action-that-sets-the-content-disposition"/>
          <map:read mime-type="application/text" src="{1}.txt"/>
      </map:match>
this way the URL in your browser will look like http://host/whatever.txt 
and IE uses the file extension used in the URL to recognize the 
content-type
Gunter





"Jain, Neeraj" <neeraj.jain@wincor-nixdorf.com> 
25-10-2004 11:31
Please respond to
users@cocoon.apache.org


To
"'users@cocoon.apache.org'" <users@cocoon.apache.org>
cc

Subject
RE: specifying filename in map:read






Have tried that already, but of no help again. I tried setting the 
content-type from setHeader as well,
      res.setHeader("Content-Disposition", "attachment; filename="+sName);
      res.setHeader("Content-Type", "text/html");
 
The entry in the sitemap is as follows:
    <map:read src="{filename}" mime-type="application/dbexport"/>
 
    I have tried modifying it to
        <map:read src="{filename}" mime-type="application/text"/> and 
<map:read src="{filename}" mime-type="application/txt"/>
 
None of above works well.
 
Neeraj.
-----Original Message-----
From: Gunter D'Hondt [mailto:gunter.dhondt@sofico.be] 
Sent: Monday, October 25, 2004 5:25 PM
To: users@cocoon.apache.org
Subject: RE: specifying filename in map:read

try setting the correct file extension in your cocoon URI coz IE always 
uses the file extension to locate which content-type that must be used 
so in your example (txt-file) your sitemap matcher must end with ".txt"; 
example: "whatever-*.txt" 
Gunter 



"Jain, Neeraj" <neeraj.jain@wincor-nixdorf.com> 
25-10-2004 11:15 

Please respond to
users@cocoon.apache.org



To
"'users@cocoon.apache.org'" <users@cocoon.apache.org> 
cc

Subject
RE: specifying filename in map:read








Thank you for reply. I am sure that the file is not empty. Also the space 
between "content-" and disposition does not do any good, unfortunately. 
  
-----Original Message-----
From: Gunter D'Hondt [mailto:gunter.dhondt@sofico.be] 
Sent: Monday, October 25, 2004 4:42 PM
To: users@cocoon.apache.org
Subject: RE: specifying filename in map:read
are you sure the file isn't empty? 
the big problem with file downloads is how to make it work in IE becourse 
IE doesn't use the standard way like Mozilla, NS, ... try placing a space 
between "content-" and "disposition" 
the [1] is something typical for IE 
Gunter 


"Jain, Neeraj" <neeraj.jain@wincor-nixdorf.com> 
25-10-2004 03:13 

Please respond to
users@cocoon.apache.org



To
"'users@cocoon.apache.org'" <users@cocoon.apache.org> 
cc

Subject
RE: specifying filename in map:read










As I updated in my previous mail that the solution suugested by Gunter 
worked fine to specify the file name. 
   response.setHeader("Content-Disposition", "attachment; 
filename=myfile.txt;"); 
I ran into another problem after modifying the header. I am not sure if 
that is a problem with browser, or I need to set another attribute in the 
header. Following is the error. 
 
   1. When I click the Download button on the html page, it displays the 
"File Download" dialog box with the filename specified in the 
"content-Disposition" header. 
 
   2. However when I click the "Open" button on the file download box, I 
get another dialog box, "Windows cannot open this file ........". Then I 
select "Select the program from a list" option and click "Ok" and then I 
select "notepad" from the "Open With" dialog box. 
   3. After this it opens the notepad application, and displays another 
dialog box with following question" 
   "Cannot find the D:\Data\...............\Temporary Internet 
Files\Content.IE5\8AFR0TYJ\myfile[1].txt. Do you want to create a new 
file?" 
 
   I click the "yes" button and but still it does not download the file 
correctly. Also I am not sure why the filename gets manipulated with "[1]" 
text. 
   Is there any setting in Ineternet Explorer to rectify this problem or 
there is something wrong with my program? 
 
   THE SAME THING WORKS WELL IN MOZILLA, i.e., FILE GETS DOWNLOAD PROPERLY 
WITH DESIRED FILE NAME. 
 
   Could someone please suggest on as to what could be wrong with my 
program. 
 
   Thank you for your help. 
 
 
 
 
-----Original Message-----
From: Gunter D'Hondt [mailto:gunter.dhondt@sofico.be] 
Sent: Friday, October 22, 2004 2:50 PM
To: users@cocoon.apache.org
Subject: Re: specifying filename in map:read 
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" <neeraj.jain@wincor-nixdorf.com> 
22-10-2004 06:33 

Please respond to
users@cocoon.apache.org



To
"'users@cocoon.apache.org'" <users@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. 

Mime
View raw message