Title: Message
Gunter,
    The current flow in the sitemap is like this:
 
<map:match pattern="export*">
   <map:act type="file-action">
    <map:read src="" mime-type="application/dbexport"/> 
    <map:redirect-to uri="{result}"/>
   </map:act>
   <map:redirect-to uri="cocoon:/main.html?title=error+in+dbexport-action"/>
</map:match>
 
In file-action I run a command and generate the file, and that file has to be opened up using map:read.
 
I did following to put the file extension in the matcher pattern, as suggested by you. But this does not help with the result.
 
Please let me know if there is something wrong with the following steps?
<map:match pattern="export*">
   <map:act type="file-action">
    <map:redirect-to uri="a.txt"/> 
   </map:act>
   <map:redirect-to uri="cocoon:/main.html?title=error+in+dbexport-action"/>
</map:match>
 
    //This should be executed if the result was ok
      <map:match pattern="*.txt">
              <map:act type="action-that-sets-the-content-disposition"/> //Should this action only set the content disposition, as I have already done the
                                                                                                        command processing in the previous action
          <map:read mime-type="application/text" src=""/>
      </map:match>
 
 
I noticed that doing res.setHeader("Content-Type","text/html") does not set the content type actually as res.containsHeader("Content-Type") returns false.
Not sure if this can be the problem.
 
Thank you for your help. 
 -----Original Message-----
From: Gunter D'Hondt [mailto:[EMAIL PROTECTED]
Sent: Monday, October 25, 2004 5:52 PM
To: [EMAIL PROTECTED]
Subject: RE: specifying filename in map:read

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=""/>
      </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" <[EMAIL PROTECTED]>

25-10-2004 11:31

Please respond to
[EMAIL PROTECTED]

To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
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="" mime-type="application/dbexport"/>
 
    I have tried modifying it to
        <map:read src="" mime-type="application/text"/> and <map:read src="" mime-type="application/txt"/>
 
None of above works well.
 
Neeraj.
-----Original Message-----
From:
Gunter D'Hondt [mailto:[EMAIL PROTECTED]
Sent:
Monday, October 25, 2004 5:25 PM
To:
[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>

25-10-2004 11:15

Please respond to
[EMAIL PROTECTED]


To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
Sent:
Monday, October 25, 2004 4:42 PM
To:
[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>

25-10-2004 03:13

Please respond to
[EMAIL PROTECTED]


To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
Sent:
Friday, October 22, 2004 2:50 PM
To:
[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>

22-10-2004 06:33

Please respond to
[EMAIL PROTECTED]


To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
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="" 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.

Reply via email to