file download
hi everybody, I want to provide the ability to my webapp's users to download a .java file clicking on a html link. My problem is that I have no save as dialog box, Im redirected to the content of my file. I changed my web.xml mime type but still the same. Any idea? _ MSN Messenger : personnalisez votre messagerie instantanée ! http://g.msn.fr/FR1001/866 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file download
Look at the Struts download action. On 7/30/05, dumbQuestionsAsker _ [EMAIL PROTECTED] wrote: hi everybody, I want to provide the ability to my webapp's users to download a .java file clicking on a html link. My problem is that I have no save as dialog box, Im redirected to the content of my file. I changed my web.xml mime type but still the same. Any idea? _ MSN Messenger : personnalisez votre messagerie instantanée ! http://g.msn.fr/FR1001/866 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file download
If you serve the java file through a servlet you can set the 'Content-disposition' header on the response to 'attachment'. dumbQuestionsAsker _ wrote: hi everybody, I want to provide the ability to my webapp's users to download a .java file clicking on a html link. My problem is that I have no save as dialog box, Im redirected to the content of my file. I changed my web.xml mime type but still the same. Any idea? _ MSN Messenger : personnalisez votre messagerie instantanée ! http://g.msn.fr/FR1001/866 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file download
And return a null after delivering the file. On 7/30/05, Robert Parsons [EMAIL PROTECTED] wrote: If you serve the java file through a servlet you can set the 'Content-disposition' header on the response to 'attachment'. dumbQuestionsAsker _ wrote: hi everybody, I want to provide the ability to my webapp's users to download a .java file clicking on a html link. My problem is that I have no save as dialog box, Im redirected to the content of my file. I changed my web.xml mime type but still the same. Any idea? _ MSN Messenger : personnalisez votre messagerie instantanée ! http://g.msn.fr/FR1001/866 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Download dialog launched errantly
Thanks Luis - I found the wmlbrowser plug-in for Mozilla, installed it, and can now display WML. Greatly appreciate it! Regards, Steve PS - wapsilon.com seems to be down at the moment - am interested in seeing their product too so will keep trying -Original Message- From: Luis Torres [mailto:[EMAIL PROTECTED] Sent: Monday, July 11, 2005 7:58 PM To: Tomcat Users List Subject: Re: File Download dialog launched errantly Hi, Actually that sounds right. You can't display WML data in a standard browser and that's why you get the download dialog. To see that type of content you can test using a WAP browser like winwap (not free but you get a trial) or an online WAP emulator such as wapsilon http://www.wapsilon.com. If it displays ok in one of those two then you are on the right track :) Hasta luego. Luis Kirby, Stephen (Civ, ARL/CISD) wrote: Hi, I am using a WML file as my welcome-file. When I try to launch the web page I'm getting a File Download dialog for some reason. (it's tomcat-5.5.9 and it shows tomcat works fine when I leave the welcome file as index.jsp) The web.xml already had the MIME mapping for wml extension files so I don't think that's the problem. (from web.xml) mime-mapping !-- WML Source -- extensionwml/extension mime-typetext/vnd.wap.wml/mime-type /mime-mapping I've triple-checked the wml file and can't see anything wrong: ?xml version=1.0? !DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml; wml card id=myFirstCard title=First Card p align=center Hi there.. /p /card /wml I've seen mention of a http.conf file -- is that relevant to jakarta tomcat; if so what line is added to recognize wml? TIA -Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File Download dialog launched errantly
Hi, I am using a WML file as my welcome-file. When I try to launch the web page I'm getting a File Download dialog for some reason. (it's tomcat-5.5.9 and it shows tomcat works fine when I leave the welcome file as index.jsp) The web.xml already had the MIME mapping for wml extension files so I don't think that's the problem. (from web.xml) mime-mapping !-- WML Source -- extensionwml/extension mime-typetext/vnd.wap.wml/mime-type /mime-mapping I've triple-checked the wml file and can't see anything wrong: ?xml version=1.0? !DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml; wml card id=myFirstCard title=First Card p align=center Hi there.. /p /card /wml I've seen mention of a http.conf file -- is that relevant to jakarta tomcat; if so what line is added to recognize wml? TIA -Steve
Re: File Download dialog launched errantly
Hi, Actually that sounds right. You can't display WML data in a standard browser and that's why you get the download dialog. To see that type of content you can test using a WAP browser like winwap (not free but you get a trial) or an online WAP emulator such as wapsilon http://www.wapsilon.com. If it displays ok in one of those two then you are on the right track :) Hasta luego. Luis Kirby, Stephen (Civ, ARL/CISD) wrote: Hi, I am using a WML file as my welcome-file. When I try to launch the web page I'm getting a File Download dialog for some reason. (it's tomcat-5.5.9 and it shows tomcat works fine when I leave the welcome file as index.jsp) The web.xml already had the MIME mapping for wml extension files so I don't think that's the problem. (from web.xml) mime-mapping !-- WML Source -- extensionwml/extension mime-typetext/vnd.wap.wml/mime-type /mime-mapping I've triple-checked the wml file and can't see anything wrong: ?xml version=1.0? !DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml; wml card id=myFirstCard title=First Card p align=center Hi there.. /p /card /wml I've seen mention of a http.conf file -- is that relevant to jakarta tomcat; if so what line is added to recognize wml? TIA -Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SSL on tomcat breaks file download
I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled xlsreports: nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: jsp:forward page=%= \xlsreports/\ + nextXLSName % / This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SSL on tomcat breaks file download
Archives: http://marc.theaimsgroup.com/?l=tomcat-userm=109818070801385w=2 http://marc.theaimsgroup.com/?l=tomcat-userm=105966032518910w=2 Jon Dobson Paul L Contr OO-ALC/LGFBR wrote: I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled xlsreports: nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: jsp:forward page=%= \xlsreports/\ + nextXLSName % / This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SSL on tomcat breaks file download
hey, it is simply an header problem. I encountered the same problem few month except that I am using servlet and not JSP file. But I think it should be exactly the same. Tomcat by default set Cache-Control and Pragma to no-cache. So you have to force those to to cache. I had to add those two line to my servlet: response.setHeader( Cache-Control, cache ); response.setHeader( Pragma,cache ); I hope it will help you Doud On Tue, 02 Nov 2004 17:32:21 +, Jon Wingfield [EMAIL PROTECTED] wrote: Archives: http://marc.theaimsgroup.com/?l=tomcat-userm=109818070801385w=2 http://marc.theaimsgroup.com/?l=tomcat-userm=105966032518910w=2 Jon Dobson Paul L Contr OO-ALC/LGFBR wrote: I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled xlsreports: nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: jsp:forward page=%= \xlsreports/\ + nextXLSName % / This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SSL on tomcat breaks file download
Worked perfectly! Thank you. Paul Dobson, F-16 Programmer/Analyst Viranim Technologies, Inc OO-ALC/LGFBR (801) 755-3679 [EMAIL PROTECTED] -Original Message- From: Edouard Dalla-Costa [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 10:34 AM To: Tomcat Users List Subject: Re: SSL on tomcat breaks file download hey, it is simply an header problem. I encountered the same problem few month except that I am using servlet and not JSP file. But I think it should be exactly the same. Tomcat by default set Cache-Control and Pragma to no-cache. So you have to force those to to cache. I had to add those two line to my servlet: response.setHeader( Cache-Control, cache ); response.setHeader( Pragma,cache ); I hope it will help you Doud On Tue, 02 Nov 2004 17:32:21 +, Jon Wingfield [EMAIL PROTECTED] wrote: Archives: http://marc.theaimsgroup.com/?l=tomcat-userm=109818070801385w=2 http://marc.theaimsgroup.com/?l=tomcat-userm=105966032518910w=2 Jon Dobson Paul L Contr OO-ALC/LGFBR wrote: I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled xlsreports: nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: jsp:forward page=%= \xlsreports/\ + nextXLSName % / This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SSL on tomcat breaks file download
Does anyone know how to setup Tomcat so that no-cache is not the default. I have a simular problem except accessing files under ssl. These are physically located on the server and when I try to open them I get an error saying the request is unavailable. Stephen -Original Message- From: Dobson Paul L Contr OO-ALC/LGFBR [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 9:49 To: 'Tomcat Users List' Subject: RE: SSL on tomcat breaks file download Worked perfectly! Thank you. Paul Dobson, F-16 Programmer/Analyst Viranim Technologies, Inc OO-ALC/LGFBR (801) 755-3679 [EMAIL PROTECTED] -Original Message- From: Edouard Dalla-Costa [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 10:34 AM To: Tomcat Users List Subject: Re: SSL on tomcat breaks file download hey, it is simply an header problem. I encountered the same problem few month except that I am using servlet and not JSP file. But I think it should be exactly the same. Tomcat by default set Cache-Control and Pragma to no-cache. So you have to force those to to cache. I had to add those two line to my servlet: response.setHeader( Cache-Control, cache ); response.setHeader( Pragma,cache ); I hope it will help you Doud On Tue, 02 Nov 2004 17:32:21 +, Jon Wingfield [EMAIL PROTECTED] wrote: Archives: http://marc.theaimsgroup.com/?l=tomcat-userm=109818070801385w=2 http://marc.theaimsgroup.com/?l=tomcat-userm=105966032518910w=2 Jon Dobson Paul L Contr OO-ALC/LGFBR wrote: I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled xlsreports: nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: jsp:forward page=%= \xlsreports/\ + nextXLSName % / This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Servlet coming as file download
Hello, I have a Apache 2.0.50 with an active mod_deflate connecting to Tomcat (4.x) via mod_jk2. After I activated deflate, sometimes when I call a servlet IE doesn´t open the page with the servlet response, but a file download window as if I was trying to download a file named 'servlet'. Can anyone please suggest a solution ? Thanks
apache2/mod_jk/tomcat4 - file download / special characters in filename
Problem: In my tomcat webapp a servlet manages a filedownload. Clicking on a file-link results in the browser's save as dialog. Using tomcat alone (port 8080) everything works fine. Special characters (like German umlaut) are shown in ISO-8859-1. Apache2/mod_jk seems to change the charset to UTF-8, e.g. täst.txt looks like tät.txt. Code: response.setHeader(Content-Disposition, attachment; filename= + file.getName()); response.setContentLength((int)file.length()); response.setContentType(application/octet-stream); response.setHeader(Content-Transfer-Encoding, binary); I tried also: response.setContentType(application/octet-stream; charset=ISO-8859-1); or String tmpName = new String(f.getName().getBytes(),ISO-8859-1); response.setHeader(Content-Disposition, attachment; charset=ISO8859-1; filename=+tmpName); or response.setHeader(Content-Transfer-Encoding, ISO-8859-1); Configuration: - Suse 8.2 - Apache2.0.48 - Tomcat4.1.18 - mod_jk - $tomcat_home/bin/catalina.sh: export CATALINA_OPTS=-Dfile.encoding=ISO-8859-1 -Duser.language=de -Duser.country=DE Who can help ? Thank's in advance ! Andreas _ Schützen Sie Ihren Posteingang vor unerwünschten E-Mails. http://www.msn.de/antispam/prevention/junkmailfilter Jetzt Hotmail-Junk-Filter aktivieren! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: apache2/mod_jk/tomcat4 - file download / special characters in filename
try converting the filename to ISO-8859-1 as well eg filename = new String(file.getName(), ISO-8859-1); Your Code (modified): response.setHeader(Content-Disposition, attachment; filename= + new String(file.getName(), ISO-8859-1)); response.setContentLength((int)file.length()); response.setContentType(application/octet-stream); response.setHeader(Content-Transfer-Encoding, binary); Hope that helps. John Sidney-Woollett Andreas Hartstack said: Problem: In my tomcat webapp a servlet manages a filedownload. Clicking on a file-link results in the browser's save as dialog. Using tomcat alone (port 8080) everything works fine. Special characters (like German umlaut) are shown in ISO-8859-1. Apache2/mod_jk seems to change the charset to UTF-8, e.g. täst.txt looks like tät.txt. Code: response.setHeader(Content-Disposition, attachment; filename= + file.getName()); response.setContentLength((int)file.length()); response.setContentType(application/octet-stream); response.setHeader(Content-Transfer-Encoding, binary); I tried also: response.setContentType(application/octet-stream; charset=ISO-8859-1); or String tmpName = new String(f.getName().getBytes(),ISO-8859-1); response.setHeader(Content-Disposition, attachment; charset=ISO8859-1; filename=+tmpName); or response.setHeader(Content-Transfer-Encoding, ISO-8859-1); Configuration: - Suse 8.2 - Apache2.0.48 - Tomcat4.1.18 - mod_jk - $tomcat_home/bin/catalina.sh: export CATALINA_OPTS=-Dfile.encoding=ISO-8859-1 -Duser.language=de -Duser.country=DE Who can help ? Thank's in advance ! Andreas _ Schützen Sie Ihren Posteingang vor unerwünschten E-Mails. http://www.msn.de/antispam/prevention/junkmailfilter Jetzt Hotmail-Junk-Filter aktivieren! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Servlet File Download solution.
Hi (B (BI had similar type of problem on windows 8 months ago We installed (Bpatch for IE5.x I can not remember exactly its better to look into (Bmicrosoft site. (B (B (B-Original Message- (BFrom: Rai Ou (BTo: 'Tomcat Users List' (BSent: 14/01/2004 8:14 AM (BSubject: HELP: Servlet File Download solution. (B (BI wrote a download servlet but I found it didn't run at IE5.x (B (BIE6.x - OK (BIE5.x - NG (BNS - OK (B (BMy source is below. I want to know if there are better solutions (Bor any Common Libarary I can use. (B (Bresponse.setHeader("Content-Disposition", (B "attachment; filename=\"" + myFileName + "\""); (Bresponse.setContentType("application/octet-stream; (B name=\"" + myFileName + "\""); (BString f = myFilePath; (BPrintWriter out = response.getWriter(); (BBufferedReader in (B= new BufferedReader(new FileReader(f)); (BString line; (Bwhile ((line = in.readLine()) != null) { (B out.println(line); (B} (Bin.close(); (B (BThanks. (BRai (B (B (B (B- (BTo unsubscribe, e-mail: [EMAIL PROTECTED] (BFor additional commands, e-mail: [EMAIL PROTECTED] (B (B- (BTo unsubscribe, e-mail: [EMAIL PROTECTED] (BFor additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Servlet File Download solution.
This probably doesn't matter, but try this instead: response.setHeader(Content-Disposition, attachment;filename=\ + myFileName + \); // Removed the space in between attachment; and filename response.setContentType(application/octet-stream); // I don't think you need to specify the filename again Using the above seems to work for me, but I'm not sure if a user with IE5 has tried it. What happens when you use it in IE5? Error message? Data output to the screen? Empty file? It might be a MIME problem also. -Brian -Original Message- From: Rai Ou [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 9:45 PM To: 'Tomcat Users List' Subject: HELP: Servlet File Download solution. I wrote a download servlet but I found it didn't run at IE5.x IE6.x - OK IE5.x - NG NS - OK My source is below. I want to know if there are better solutions or any Common Libarary I can use. response.setHeader(Content-Disposition, attachment; filename=\ + myFileName + \); response.setContentType(application/octet-stream; name=\ + myFileName + \); String f = myFilePath; PrintWriter out = response.getWriter(); BufferedReader in = new BufferedReader(new FileReader(f)); String line; while ((line = in.readLine()) != null) { out.println(line); } in.close(); Thanks. Rai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HELP: Servlet File Download solution.
I wrote a download servlet but I found it didn't run at IE5.x (B (BIE6.x - OK (BIE5.x - NG (BNS - OK (B (BMy source is below. I want to know if there are better solutions (Bor any Common Libarary I can use. (B (Bresponse.setHeader("Content-Disposition", (B "attachment; filename=\"" + myFileName + "\""); (Bresponse.setContentType("application/octet-stream; (B name=\"" + myFileName + "\""); (BString f = myFilePath; (BPrintWriter out = response.getWriter(); (BBufferedReader in (B= new BufferedReader(new FileReader(f)); (BString line; (Bwhile ((line = in.readLine()) != null) { (B out.println(line); (B} (Bin.close(); (B (BThanks. (BRai (B (B (B (B- (BTo unsubscribe, e-mail: [EMAIL PROTECTED] (BFor additional commands, e-mail: [EMAIL PROTECTED]
Re: File download impact JSP running
Hello, I know nothing about Content-Disposition. In fact, the only thing I know is that we never needed/used it ;-) Maybe it is too obvious, but I suggest you to try response.setContentType() instead. Anyway, I will try to get a code snippet from one of our apps a bit later for you. Hope that helps a little bit. Antonio Fiol Cui Xiaojing-a13339 wrote: Hello All, I use below a set of commands to download a file, after the file is saved into local disk, the current JSP page (Jreport_main.jsp) could not work correctly. After the current page is refreshed, it can work again. Does setting header in response impact the jsp running? Could please give some advice? Thanks. FileDAO fd=new FileDAO(); response.setHeader(Cache-Control, no-cache); File f=new File(e:/report.xls); response.addHeader(Content-disposition, attachment; filename= +f.getName()); ServletOutputStream out = response.getOutputStream(); FileInputStream in=new FileInputStream(f); int b; while ((b=in.read())!=-1){ out.write(b); } in.close(); out.close(); RequestDispatcher rd = getServletContext().getRequestDispatcher(/Jreport_main.jsp); rd.forward(request, response); Regards, Xiaojing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File download impact JSP running
Hi! Sorry about my previous response: I missed the important point. Here is what the RFC says about Content-Disposition (two fragments of RFC 2616). Anyway, the important part is that you SHOULD NOT send your file AND a web page after it. In your code snippet, you loop over the file, sending it, and then you forward to a JSP file. That is, simply, not possible. If you want to do the same thing which is implemented in, i.e. sourceforge (a page appears and a file starts downloading, more or less at the same time), I suggest you to read the HTML code they have. Good luck! Antonio Fiol 15.5 Content-Disposition Issues RFC 1806 http://www.faqs.org/rfcs/rfc1806.html [35], from which the often implemented Content-Disposition (see section 19.5.1) header in HTTP is derived, has a number of very serious security considerations. Content-Disposition is not part of the HTTP standard, but since it is widely implemented, we are documenting its use and risks for implementors. See RFC 2183 http://www.faqs.org/rfcs/rfc2183.html [49] (which updates RFC 1806 http://www.faqs.org/rfcs/rfc1806.html) for details. 19.5.1 Content-Disposition The Content-Disposition response-header field has been proposed as a means for the origin server to suggest a default filename if the user requests that the content is saved to a file. This usage is derived from the definition of Content-Disposition in RFC 1806 http://www.faqs.org/rfcs/rfc1806.html [35]. content-disposition = Content-Disposition : disposition-type *( ; disposition-parm ) disposition-type = attachment | disp-extension-token disposition-parm = filename-parm | disp-extension-parm filename-parm = filename = quoted-string disp-extension-token = token disp-extension-parm = token = ( token | quoted-string ) An example is Content-Disposition: attachment; filename=fname.ext The receiving user agent SHOULD NOT respect any directory path information present in the filename-parm parameter, which is the only parameter believed to apply to HTTP implementations at this time. The filename SHOULD be treated as a terminal component only. If this header is used in a response with the application/octet- stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a `save response as...' dialog. See section 15.5 for Content-Disposition security issues. Cui Xiaojing-a13339 wrote: Hello All, I use below a set of commands to download a file, after the file is saved into local disk, the current JSP page (Jreport_main.jsp) could not work correctly. After the current page is refreshed, it can work again. Does setting header in response impact the jsp running? Could please give some advice? Thanks. FileDAO fd=new FileDAO(); response.setHeader(Cache-Control, no-cache); File f=new File(e:/report.xls); response.addHeader(Content-disposition, attachment; filename= +f.getName()); ServletOutputStream out = response.getOutputStream(); FileInputStream in=new FileInputStream(f); int b; while ((b=in.read())!=-1){ out.write(b); } in.close(); out.close(); RequestDispatcher rd = getServletContext().getRequestDispatcher(/Jreport_main.jsp); rd.forward(request, response); Regards, Xiaojing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File download impact JSP running
Hello The RequestDispatcher.forward method 'should be called before the response has been committed to the client' as quoted from: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/servletapi/index.html I think your code is breaking that rule. Regards Harry Mantheakis London, UK Hello All, I use below a set of commands to download a file, after the file is saved into local disk, the current JSP page (Jreport_main.jsp) could not work correctly. After the current page is refreshed, it can work again. Does setting header in response impact the jsp running? Could please give some advice? Thanks. FileDAO fd=new FileDAO(); response.setHeader(Cache-Control, no-cache); File f=new File(e:/report.xls); response.addHeader(Content-disposition, attachment; filename= +f.getName()); ServletOutputStream out = response.getOutputStream(); FileInputStream in=new FileInputStream(f); int b; while ((b=in.read())!=-1){ out.write(b); } in.close(); out.close(); RequestDispatcher rd = getServletContext().getRequestDispatcher(/Jreport_main.jsp); rd.forward(request, response); Regards, Xiaojing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File download impact JSP running
Hello All, I use below a set of commands to download a file, after the file is saved into local disk, the current JSP page (Jreport_main.jsp) could not work correctly. After the current page is refreshed, it can work again. Does setting header in response impact the jsp running? Could please give some advice? Thanks. FileDAO fd=new FileDAO(); response.setHeader(Cache-Control, no-cache); File f=new File(e:/report.xls); response.addHeader(Content-disposition, attachment; filename= +f.getName()); ServletOutputStream out = response.getOutputStream(); FileInputStream in=new FileInputStream(f); int b; while ((b=in.read())!=-1){ out.write(b); } in.close(); out.close(); RequestDispatcher rd = getServletContext().getRequestDispatcher(/Jreport_main.jsp); rd.forward(request, response); Regards, Xiaojing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to write file download program
Hi, I am afraid to ask some instruction for my work. I am thinking to write a program to help client to download some sound file from server. Client send request to download a file in server. The request includes the file name and directory he want the file to be loaded onto. the request invokes the download program callled for example as download.php in server.(Apache). The download.php retrieve the sound file (greeting.wav) and download the file to client. Besides. i need to wirte a upload program called upload.php help client to upload file from client to server. Any help will be really appreciated. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
AW: how to write file download program
You know that you are on a java oriented list, and i assume that not much of the members are php-experienced. Mike -Ursprüngliche Nachricht- Von: bin cai [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 09. Oktober 2003 12:08 An: Tomcat Users List Betreff: how to write file download program Hi, I am afraid to ask some instruction for my work. I am thinking to write a program to help client to download some sound file from server. Client send request to download a file in server. The request includes the file name and directory he want the file to be loaded onto. the request invokes the download program callled for example as download.php in server.(Apache). The download.php retrieve the sound file (greeting.wav) and download the file to client. Besides. i need to wirte a upload program called upload.php help client to upload file from client to server. Any help will be really appreciated. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
question on creating a file download servlet
I need to write a servlet that handles file downloads, so that I can audit who downloaded from where, when..etc. When I click on the link to download a file, the Save As window comes up in my browser(Netscape), and as a default filename I get the servlet name. Is there a way to list the actual filename in the Save As window ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: question on creating a file download servlet
Howdy, Use the content-disposition header: http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html Yoav Shapira Millennium ChemInformatics -Original Message- From: Mark W. Webb [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2003 3:34 PM To: [EMAIL PROTECTED] Subject: question on creating a file download servlet I need to write a servlet that handles file downloads, so that I can audit who downloaded from where, when..etc. When I click on the link to download a file, the Save As window comes up in my browser(Netscape), and as a default filename I get the servlet name. Is there a way to list the actual filename in the Save As window ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question on creating a file download servlet
...thank you. Shapira, Yoav wrote: Howdy, Use the content-disposition header: http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html Yoav Shapira Millennium ChemInformatics -Original Message- From: Mark W. Webb [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2003 3:34 PM To: [EMAIL PROTECTED] Subject: question on creating a file download servlet I need to write a servlet that handles file downloads, so that I can audit who downloaded from where, when..etc. When I click on the link to download a file, the Save As window comes up in my browser(Netscape), and as a default filename I get the servlet name. Is there a way to list the actual filename in the Save As window ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question on creating a file download servlet
check this out: http://www.fawcette.com/javapro/2002_03/online/online_eprods/servlets_03_08/ budi ---Original Message--- From: Mark W. Webb Subject: question on creating a file download servlet Sent: 09 Jun 2003 19:33:37 I need to write a servlet that handles file downloads, so that I can audit who downloaded from where, when..etc. When I click on the link to download a file, the Save As window comes up in my browser(Netscape), and as a default filename I get the servlet name. Is there a way to list the actual filename in the Save As window ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---Original Message---
[OT] cache problems with IE after file download...could it be tomcat?
Hi everyone: This is more related to Java than tomcat i guess! But any input would be greatly appreciated. This is a question that has been around for a while now...I tried looking up the forums on Sun's website...but could not really find a solution to solve my problem...so here goes... I have implemented a file download bean which sends out binary data to the browser. The bean is instantiated by a JSP page. To make sure browsers don't cache response I do: response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(max-age, 0); response.setDateHeader(Expires, 0); while sending out the file and on every other JSP page on the site. However, for some reason the JSP page accessed immediately after downloading a file contains portions of a binary stream on the top of the page followed by HTML. I am confident the server is not resending the data again...(confirmed it with ethereal and nescape works too)...so I dont know what I am doing wrong...or what I should do to get it right...Any suggestions ot opinions on this? Note that the headers work perfectly fine while navigating through JSP pages. Thanks Prashanth __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weird error using file download
I got a very weird error and here is the situation: The app I used: tomcat 4.06, phoenix web browser 0.3, ie6.0 Here is the problem: When I set up an application in tomcat (with BASIC AUTHEN), phoenix could download all binary files (.exe, .pdf, etc...) fine from Tomcat server. Then I tested with IE6.0, and I got error (server could not find the file or something). However, IE6.0 could download text file ok without any problem. Ok, so I came back and delete the file index.html in the application, and I can download the file fine. Isn't this strange? But that's not all yet. I want to serve files using a servlet wraper. Basically send back the binary with the right content type. Mozilla/phoenix can download without any problem. But IE6.0 complain with the same error before. So, somehow the index.html file and the servlet have something in common that make IE not working while it works without the index.html and statically. Well, want another strange thing? I could not find anyone complain about this, or even ask any question about this in newsgroup or apache site. And I can produce consistently using different machine. Anyone have any idea? Is it Apache Tomcat or IE error? Or both? Or it's me? I am sure Tomcat can be changed to work, since statically served page works. And I am sure IE can be changed to work, since Mozilla works all the time. Actually, I found any article in the newsgroup on Google with a similar error, but very different situation (IIS server). And the problem is in the expiration of a page. If some page has instant expiration, then IE6 has problem getting it. It could be the same problem. Coudl someone help me out here since IE has 95% of the market share? Thank you very much in advance. Vy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
File Download and then Reloading a page
Hi, I would like to be able within a servlet to launch a file download and just after reloading a jsp page( =The servlet generates two response ). Is it possible ? Thanks Michenaud Laurent - Adeuza - [ Développeur Web - Administrateur Réseau ] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
File Download and then Reloading a page
Hi, I would like to be able within a servlet to launch a file download and just after reloading a jsp page( =The servlet generates two response ). Is it possible ? Thanks Michenaud Laurent - Adeuza - [ Développeur Web - Administrateur Réseau ] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: File Download and then Reloading a page
I would like to be able within a servlet to launch a file download and just after reloading a jsp page( =The servlet generates two response ). Is it possible ? No, but you can give a JSP/HTML page in response that will have JScript function that opens another page that will be just a download (the URL will point to the document or to a Servlet that will in response give the document). The function should be in onLoad attribute of the body tag. In other words, any such forking must be done on the client side - HTTP is one-request-one-response model. Nix.
IIS - jsp file download on port 80
First, thanks in advance for any help with this... I've gotten Tomcat 4.0.4 set up and everything works well if I connect to port 8080. I'd like to be able to serve servlets and jsp's transparently to users over port 80. However, if I connect through port 80 and try to grab a .jsp file all I get is a download prompt asking me if I want to save the file to my hard drive. (You can see for yourself: http://128.200.156.162/home/jsp-files/fruit.jsp http://128.200.156.162/home/jsp-files/fruit.jsp ). (you can also see that Tomcat works on port 8080: http://128.200.156.162:8080/jsp-files/fruit.jsp http://128.200.156.162:8080/jsp-files/fruit.jsp ) I'm not sure what needs to be changed. Do I need to add an application mapping for .jsp's to the default web site in IIS? If that's so, I'm not sure what to map it _to_. Would it be isapi_redirector.dll? I tried setting Tomcat to run on port 80, but Tomcat just breaks. Is the problem that I'm using the warp connector? Should I be using something else? I've put a copy of all the Tomcat configuration files in: http://128.200.156.162/home/jeff/tomcat/conf/ http://128.200.156.162/home/jeff/tomcat/conf/ . As far as I can tell, everything is set up correctly... I took out ajp12 because it isn't used in anything. Removing it didn't seem to affect anything... I'll be happy to summarize and post the solution to the group, once it's worked out. And again, thanks for any help! Jeff Polaski Manager, Web Services Research Graduate Studies University California, Irvine -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: IIS - jsp file download on port 80
Try adding a application mapping in your IIS console. (IIS console -- Home Directory -- Configuration App Mapping), I'm using IIS 5.0 in win2k professional. In this console add the .jsp entension and map it to isapi_redirect(or).dll where ever it is stored. That should work. Also, check to see if your web application has script and executable access. Prashanth --- Jeffrey Polaski [EMAIL PROTECTED] wrote: First, thanks in advance for any help with this... I've gotten Tomcat 4.0.4 set up and everything works well if I connect to port 8080. I'd like to be able to serve servlets and jsp's transparently to users over port 80. However, if I connect through port 80 and try to grab a .jsp file all I get is a download prompt asking me if I want to save the file to my hard drive. (You can see for yourself: http://128.200.156.162/home/jsp-files/fruit.jsp http://128.200.156.162/home/jsp-files/fruit.jsp ). (you can also see that Tomcat works on port 8080: http://128.200.156.162:8080/jsp-files/fruit.jsp http://128.200.156.162:8080/jsp-files/fruit.jsp ) I'm not sure what needs to be changed. Do I need to add an application mapping for .jsp's to the default web site in IIS? If that's so, I'm not sure what to map it _to_. Would it be isapi_redirector.dll? I tried setting Tomcat to run on port 80, but Tomcat just breaks. Is the problem that I'm using the warp connector? Should I be using something else? I've put a copy of all the Tomcat configuration files in: http://128.200.156.162/home/jeff/tomcat/conf/ http://128.200.156.162/home/jeff/tomcat/conf/ . As far as I can tell, everything is set up correctly... I took out ajp12 because it isn't used in anything. Removing it didn't seem to affect anything... I'll be happy to summarize and post the solution to the group, once it's worked out. And again, thanks for any help! Jeff Polaski Manager, Web Services Research Graduate Studies University California, Irvine -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: File download with Tomcat 4.0.2
hi, At 02:34 PM 31/05/2002 -0700, you wrote: Hello, How do I force Tomcat to serve a file as a download, instead of displaying it in the browser? you don't, because it's up to the browser to decide. you can zip up all the files you want to offer for download, but any content-type the browser knows, it'll display. thorsten frank [software developer] LPIP Australasia http://www.liquidprotocol.com ACN:096 239 039 Level 1/368 Crown Street Darlinghurst 2010 Sydney, Australia P: [02] 9332 1933 F: [02] 9332 1822 Disclaimer The above information is confidential to the addressee and may be privileged. Unauthorized access and use is prohibited. Internet communications are not secure and therefore this company does not accept legal responsibility for the contents of this message. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on it, is prohibited and may be unlawful -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: File download with Tomcat 4.0.2
Hi Alex, I think that's actully up to the browser to determinate wheter the browser should display the data, if a helper application should do so or if the user should be prompted to download the file without displaying or executing it. So, in other words, what you need to do is to say on the page which links to the file that if the browser just displays the data you need to press [ALT] on Mac while downloading (and is it [SHIFT] on Windows?). However if your userbase i pretty constant like on an intranet you could send out instructions that files with the extension fls shouldn't be displayed in the browser but instead should the user be prompted for download (or maybe even more convinient - opened in the right application). Markus On Friday, May 31, 2002, at 11:34 PM, Alex Roussev wrote: Hello, How do I force Tomcat to serve a file as a download, instead of displaying it in the browser? For example, if I have an href pointing to a filename with extention exe and I click on the href within a browser it will prompt me to save this file. So basically, I want to do this with another file extention ( fls ). However, when I click on the href Tomcat displays the contents of this file in the browser. Is there something I need to set up the web.xml file? Do I need to define another mime-mapping ? Thank you, Alex - Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
File download with Tomcat 4.0.2
Hello, How do I force Tomcat to serve a file as a download, instead of displaying it in the browser? For example, if I have an href pointing to a filename with extention exe and I click on the href within a browser it will prompt me to save this file. So basically, I want to do this with another file extention ( fls ). However, when I click on the href Tomcat displays the contents of this file in the browser. Is there something I need to set up the web.xml file? Do I need to define another mime-mapping ? Thank you, Alex - Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup
Re: File download with Tomcat 4.0.2
yes, define a mime-mapping is this not a common mime type (one you've made up yourself)? If so, many browsers will display anything they perceive as text data right in the browser itself by default. you're running into a somewhat complex interaction of client browser software and server software. Try the mime-mapping and see what happens. fillup On 5/31/02 2:34 PM, Alex Roussev [EMAIL PROTECTED] wrote: Hello, How do I force Tomcat to serve a file as a download, instead of displaying it in the browser? For example, if I have an href pointing to a filename with extention exe and I click on the href within a browser it will prompt me to save this file. So basically, I want to do this with another file extention ( fls ). However, when I click on the href Tomcat displays the contents of this file in the browser. Is there something I need to set up the web.xml file? Do I need to define another mime-mapping ? Thank you, Alex - Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
File Download
Hello, i'm downloading a file from a servlet. So far all is OK, besides that IE5 displays the URL in the save dialog. I have a problem when using the compress filter - my file is no longer stored with the correct MIME type (in this case 'mdb'). How can i download a zipped application file and also using the compress filter. Thanks for any help in advance Reto -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: File Download - CSV question ****
You should have a look at the mime type definition for .csv in both installations. Alberto -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 22:11 To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
On Thu, 25 Oct 2001, Evan Swanson wrote: I am using IE5.0 in both situations. The only difference is going from TC3.2 on windows to TC4.0 on HP Unix. I would think that the IE would be making the decision on how to handle the file by the extension name but it is not. technically speaking it should (and by the sounds of it is) be looking at the mime type. Is MIME type something you can configure on Tomcat? I'm not on solid ground here, so I'll let someone else answer it. I know that in $TOMCAT_HOME/conf/web.xml and $CATALINA_HOME/conf/web.xml there are mime-types listed, but I'm not sure if changing them will change the behaviour (I remember a lot of discussion about this a few months back in relation to tc3 and my memory is that the conf/web.xml is not read by the container, but I could be wrong). So if someone else with firm knowledge could answer that one we'd both be wiser (o: cheers dim -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
On Thu, 25 Oct 2001, Evan Swanson wrote: Date: Thu, 25 Oct 2001 13:22:06 -0700 From: Evan Swanson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Cc: 'Dmitri Colebatch' [EMAIL PROTECTED] Subject: RE: File Download - CSV question I order to reduce the variable, I tried installing TC4.0 on the same windows based machine. I am using the same client for both( IE5.0 ). Results: TC3.2 will present a popup box for downloading files with .CSV extention. TC4.0 throws data directly up on the screen. In a servlet 2.3 environment, the default content type is not allowed to be set on the download. You must declare it yourself (see below). Is there any reason for this? Can I change the configuration? Yes. Yes. Is this a MIME type problem? Yes. You can declare the appropriate content types for your files by using the mime-type declaration like this in your web.xml file: mime-mapping extensioncsv/extension mime-typeapplication/octet-stream/mime-type /mime-mapping The other important issue is what your *browser* thinks a particular file type should be. Netscape Navigator is usually pretty good about respecting the Content-Type header sent by the server, while IE tends to make its own assumptions about the file type, no matter what yo do on the server side. Craig McClanahan
RE: File Download - CSV question ****
Without being an expert on TomCat, I'd say straight away that this is a MIME error. You need to set the MIME for .csv files to something that's not parsed by the browser, like, application/x-whatever. Fiddle around with that. I think the MIMES are in the server.xml file. I could be wrong though. /Christopher Cato -Original Message- From: Evan Swanson [mailto:[EMAIL PROTECTED]] Sent: den 25 oktober 2001 22:22 To: '[EMAIL PROTECTED]' Cc: 'Dmitri Colebatch' Subject: RE: File Download - CSV question I order to reduce the variable, I tried installing TC4.0 on the same windows based machine. I am using the same client for both( IE5.0 ). Results: TC3.2 will present a popup box for downloading files with .CSV extention. TC4.0 throws data directly up on the screen. Is there any reason for this? Can I change the configuration? Is this a MIME type problem? -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
I order to reduce the variable, I tried installing TC4.0 on the same windows based machine. I am using the same client for both( IE5.0 ). Results: TC3.2 will present a popup box for downloading files with .CSV extention. TC4.0 throws data directly up on the screen. Is there any reason for this? Can I change the configuration? Is this a MIME type problem? The next question is: is it a real .csv file or is it a file generated on the fly by a servlet? CF -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
That was it! Thank you very much for your help. The WEB.XML file seems to be much different on version 4.0 very good help thanks again... -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 10:52 PM To: '[EMAIL PROTECTED]' Cc: 'Dmitri Colebatch' Subject: RE: File Download - CSV question On Thu, 25 Oct 2001, Evan Swanson wrote: Date: Thu, 25 Oct 2001 13:22:06 -0700 From: Evan Swanson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Cc: 'Dmitri Colebatch' [EMAIL PROTECTED] Subject: RE: File Download - CSV question I order to reduce the variable, I tried installing TC4.0 on the same windows based machine. I am using the same client for both( IE5.0 ). Results: TC3.2 will present a popup box for downloading files with .CSV extention. TC4.0 throws data directly up on the screen. In a servlet 2.3 environment, the default content type is not allowed to be set on the download. You must declare it yourself (see below). Is there any reason for this? Can I change the configuration? Yes. Yes. Is this a MIME type problem? Yes. You can declare the appropriate content types for your files by using the mime-type declaration like this in your web.xml file: mime-mapping extensioncsv/extension mime-typeapplication/octet-stream/mime-type /mime-mapping The other important issue is what your *browser* thinks a particular file type should be. Netscape Navigator is usually pretty good about respecting the Content-Type header sent by the server, while IE tends to make its own assumptions about the file type, no matter what yo do on the server side. Craig McClanahan
RE: File Download - CSV question ****
On Fri, 26 Oct 2001, Dmitri Colebatch wrote: Date: Fri, 26 Oct 2001 15:10:03 +1000 From: Dmitri Colebatch [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: File Download - CSV question On Thu, 25 Oct 2001, Evan Swanson wrote: I am using IE5.0 in both situations. The only difference is going from TC3.2 on windows to TC4.0 on HP Unix. I would think that the IE would be making the decision on how to handle the file by the extension name but it is not. technically speaking it should (and by the sounds of it is) be looking at the mime type. Is MIME type something you can configure on Tomcat? Yes -- either in Tomcat or in your application web.xml. These MIME type settings are used by Tomcat when it serves static resources, or you can look them up yourself via ServletContext.getMimeType(). For Tomcat 4 (the technique is different on 3.x and I don't recall the details), you can set MIME types globally by modifying $TOMCAT_HOME/conf/web.xml. For all versions of Tomcat, you can define MIME types in your own web.xml file by adding mime-mapping elements. For example: mime-mapping extensionhtml/extension mime-typetext/html/mime-type /mime-mapping is how Tomcat knows what content type to set on HTML pages. To trigger a download dialog for CSV files (the original question on this thread), you need to configure a MIME type that your browser doesn't recognize -- usually application/octet-stream will work. On the other hand, you can configure things to fire off Excel automatically, as well (if your browser is set up that way) by saying something like: mime-mapping extensioncsv/extension mime-typeapplication/msexcel/mime-type /mime-mapping (Check the file types configuration in your browser to find out what the correct MIME types should be.) Craig
File Download - CSV question
I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
Re: File Download - CSV question ****
Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: **** File Download - CSV question ****
one simple thing, just try it out on ur windows machine, in browser window...location bar... write the url u r trying to open thru anchor link.. i.e. in browser window location bar : http://servername/direcorypath/filename.csv and see, if it opens up the file in browser or pops up 'save as' dialog box. If it shows u save as dialog box, then that means, your browser doesn't support interpretation/opening of that file into it. regards, Chintan -Original Message- From: Evan Swanson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 9:01 PM To: '[EMAIL PROTECTED]' Subject: File Download - CSV question I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
I also believe that you can configure IE to prompt you for different file types. Filip ~ Namaste - I bow to the divine in you ~ Filip Hanik Software Architect [EMAIL PROTECTED] www.filip.net -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
Thanks for answering... That is the thing, I am using the same client in both situations. I am using IE5.0 in both situations. The only difference is going from TC3.2 on windows to TC4.0 on HP Unix. I would think that the IE would be making the decision on how to handle the file by the extension name but it is not. Is MIME type something you can configure on Tomcat? -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: File Download - CSV question ****
I order to reduce the variable, I tried installing TC4.0 on the same windows based machine. I am using the same client for both( IE5.0 ). Results: TC3.2 will present a popup box for downloading files with .CSV extention. TC4.0 throws data directly up on the screen. Is there any reason for this? Can I change the configuration? Is this a MIME type problem? -Original Message- From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:11 PM To: Tomcat-User Subject: Re: File Download - CSV question Are you using the same client between the two servers? IE seems to consider itself more important than mimetypes, and if it sees a file extension it recognises it treats it as it deems fit, regardless of the mimetype. So one possibility is that you have just installed excel or something on the client, and IE is redirecting the download there. another option is that the mimetype being sent in tomcat 4.0 is different to 3.x, but I'm not sure about this, so will let someone else answer this option. if you outline exactly what client/server you were using before, and now, it will make the question more specific. for intsance, tc3.2 on windows with a win98 client with IE4.0 and now using tc4.0 on linux with a win2k client with IE5.0. cheers dim On Wed, 24 Oct 2001, Evan Swanson wrote: I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
**** File Download - CSV question ****
I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
File Download - CSV question ****
I wrote an application that for Tomcat 3.2 running on window. In the HTML the is a reference ( A HREF=/filname.csv ) to the filename. When I run this on windows I get a popup save as selection box. When I run this on Tomcat4.0 on Unix it no longer gives me the selection box but instead displays the data on the screen. Is this a difference between TC32 adn TC40 or Unix / Windows. Is this configurable. Thanks in advance.
RE: file download servlet
Hi, Could you please check the link given below.It shows how to use Content-Disposition etc. http://www.esus.com/javaindex/j2ee/servlets/servletdlbinaryfile.html Regards Dinu -Original Message- From: Alexander Jesse [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 12, 2001 11:54 AM To: tomcat-user Subject: RE: file download servlet Hi, have you tried with different browsers? I remember vaguely that this kind of stuff can also be working in one browser and not work in another one... regards Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 11, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: file download servlet I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: file download servlet
But how exactly does web server instruct web browser to save the stream of bytes into a filename as filename on server? Does web server send any HTTP header like Content-Disposition to specify the file name to save? Since If i dont' set any HTTP headers in my servlet but just send the bytes. Browser will save the file as servlet name. thanks again --- Alexander Jesse [EMAIL PROTECTED] wrote: Hi, have you tried with different browsers? I remember vaguely that this kind of stuff can also be working in one browser and not work in another one... regards Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 11, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: file download servlet I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: file download servlet
The server sends a header that describes the file type. See mime types. At 10:45 AM 9/12/2001, you wrote: But how exactly does web server instruct web browser to save the stream of bytes into a filename as filename on server? Does web server send any HTTP header like Content-Disposition to specify the file name to save? Since If i dont' set any HTTP headers in my servlet but just send the bytes. Browser will save the file as servlet name. thanks again --- Alexander Jesse [EMAIL PROTECTED] wrote: Hi, have you tried with different browsers? I remember vaguely that this kind of stuff can also be working in one browser and not work in another one... regards Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 11, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: file download servlet I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: file download servlet
In your servlet's doGet processing, you will need to have a line of code like: resp.setContentType(text/plain); Of course, for your mp3 file, it won't be text/plain, but a different mime-type (audio/mpeg or whatever) - Tony -Original Message- From: Tim O'Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 12, 2001 2:04 PM To: [EMAIL PROTECTED] Subject: RE: file download servlet The server sends a header that describes the file type. See mime types. At 10:45 AM 9/12/2001, you wrote: But how exactly does web server instruct web browser to save the stream of bytes into a filename as filename on server? Does web server send any HTTP header like Content-Disposition to specify the file name to save? Since If i dont' set any HTTP headers in my servlet but just send the bytes. Browser will save the file as servlet name. thanks again --- Alexander Jesse [EMAIL PROTECTED] wrote: Hi, have you tried with different browsers? I remember vaguely that this kind of stuff can also be working in one browser and not work in another one... regards Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 11, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: file download servlet I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Re: file download servlet
Hi, To download file with the specific file name like song.mp3 as your following url http://192.168.1.105/download/servlet/download?filename=song.mp3 changed it with following url- http://192.168.1.105/download/servlet/download/song.mp3?filename=song.mp3 . So while downloading the extrapath song.mp3 will be the filename. -Ketan chiuming wrote: I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: file download servlet
you could go a step further than that, and remove the query string altogether, extracting it from the request url. That way the end user wouldn't even know it was being served by a servlet (well, the /servlet might give it away, but you could change that if it mattered)... cheers dim On Thu, 13 Sep 2001, Ketan Patel wrote: Hi, To download file with the specific file name like song.mp3 as your following url http://192.168.1.105/download/servlet/download?filename=song.mp3 changed it with following url- http://192.168.1.105/download/servlet/download/song.mp3?filename=song.mp3 . So while downloading the extrapath song.mp3 will be the filename. -Ketan chiuming wrote: I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: file download servlet
I was using the path in a similar way but passing the whole URL: e.g. http://192.168.1.105/test1/servlet/test1/http://www.example.com/main/page1.html This worked fine for tomcat v3.2.1 but when I upgraded to v3.2.3 the '//' got converted to '/'. I realise this was for security reasons but, out of interest, is the above URL really considered illegal or a security threat? - Original Message - From: Dmitri Colebatch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 13, 2001 1:48 PM Subject: Re: file download servlet you could go a step further than that, and remove the query string altogether, extracting it from the request url. That way the end user wouldn't even know it was being served by a servlet (well, the /servlet might give it away, but you could change that if it mattered)... cheers dim On Thu, 13 Sep 2001, Ketan Patel wrote: Hi, To download file with the specific file name like song.mp3 as your following url http://192.168.1.105/download/servlet/download?filename=song.mp3 changed it with following url- http://192.168.1.105/download/servlet/download/song.mp3?filename=song.mp3 . So while downloading the extrapath song.mp3 will be the filename. -Ketan chiuming wrote: I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
file download servlet
I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: file download servlet
Hi, have you tried with different browsers? I remember vaguely that this kind of stuff can also be working in one browser and not work in another one... regards Alexander -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 11, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: file download servlet I asked this question before, but I didn't get any reply. I post it again in hope someone could give me some hint. I have a file download servlet serves web browsers. request to file is like this http://192.168.1.105/download/servlet/download?filename=song.mp3 The file on the server side is song.mp3. But the file got download to browser is the servlet name instead. :( I heard i need to use the HTTP header res.setHeader(Content-Disposition,attachment; filename=\ + downloadFile + \;); Is Content-Disposition a standard header in HTTP spec? I heard i should use this whenever I don't want the content display on browser (force Save as Dialog box) Why everytime I download a file from the web server like song.mp3. there is no such HTTP header from web server? -- Content-Disposition I think web server is just like a download servlet. It sends raw bytes to web browser. After browser get the bytes, It will not konw what name the file should save as. Web server must send some kind of HTTP header to tell web browser what file name the file is saved as. right? How exactly is web server instruct web browser to pop up Save as Dialog box (on unknown mime type) and save the file with name = filename on server? Does web server use any special HTTP Header (like Content-Disposition) thanks. __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: setContentType / File download
Please help, we encounter similar problem but with IE5.5 only (no problem with all Netscapes, and IE5.01 and below versions). Seems MS has changed something in IE5.5 Kenneth -Original Message- From: Gerd Trautner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 14, 2001 4:08 PM To: tomcat-user Subject:setContentType / File download Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.csv\"\nConte nt-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. any tips? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: setContentType / File download
On Wed, 14 Mar 2001 09:07:57 +0100, Gerd Trautner wrote: Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.csv\"\nContent-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. On the cocoon-users there's been a discussion about the following code response.setHeader("Content-Disposition", "inline;filename=kluge.txt"); they said it was an "unofficial" IE header for the same purpose. haven't tested it myself, but looks like we now have two complementry solutions, for IE and NS :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
AW: setContentType / File download
Hi, try this: response.setContentType(application/msexcel); response.setHeader("Content-Disposition","inline; filename="here goes my filename"); this works for me in IE and NS. WBR Andreas Mecky -Ursprungliche Nachricht- Von: Gerd Trautner [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 14. Marz 2001 09:08 An: tomcat-user Betreff: setContentType / File download Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.cs v\"\nContent-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. any tips? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: setContentType / File download
oh goodie... someone else who has this problem! I battled this one for a long time and finally, microsoft sent out the following article on their web: http://support.microsoft.com/support/kb/articles/Q279/6/67.ASP And here is another article which I find interesting: http://support.microsoft.com/support/kb/articles/Q267/9/91.ASP My guess... M$ tried to fix the bug in the later one but screwed up somewhere along the line which resulted in the first one. Anyways. This is due to one of the very few *acknowledged* (by Microsoft I mean) bugs in IE 5.5 so sorry, nothing you can do about it! but on the bright side... it's nothing you did wrong either ;o) (this is what I'm trying to convince myself of after spending waaayyy to much time on this). Regards, Stefan. p.s. If you're using tomcat I'd suggest you use this code instead of what you have (just for readability): response.setContentType("application/msexcel"); response.setHeader("Content-Disposition","attachment;filename=TUInventor y.csv"); p.p.s. I solved this by checking the "User-Agent" header in the request and if it was IE5.5 I don't set the Content disposition header. This pops up the Save file/open dialog box but if you choose to save you'll get a garbled name... but at least you'll get the file! -Original Message- From: Gerd Trautner [mailto:[EMAIL PROTECTED]] Sent: 14. mars 2001 08:08 To: tomcat-user Subject: setContentType / File download Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.csv\"\nC ontent-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. any tips? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: AW: setContentType / File download
Andreas Mecky, Wednesday, March 14, 2001, 1:14:45 PM, you wrote: Hi, try this: response.setContentType(application/msexcel); response.setHeader("Content-Disposition","inline; filename="here goes my filename"); this works for me in IE and NS. yes, this works. thanks! gerd
setContentType / File download
Hi tomcat-user, i have some troubles using the setContentType method. I want to generate a CSV file of my database data and send it to the browser. the browser should then say "save file as filenam.csv" ... what i do is: response.setContentType("application/msexcel;name=\"TUInventory.csv\"\nContent-Disposition: attachment;filename=TUInventory.csv;"); this works for netscape browsers, but ie wants to save index.html. any tips? Gerd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]