Ok, thanks for you hints! But I haven't understood two things:
1) How can I get a file using HTTPUrlConnection or HttpsURLConnection classes? Which APIs must I use? 2) How can I read the file and send it to the user "on the fly"? When I download the file before sending it to the user I must store it somewhere....but where? Which type of java variables must I use to store the file that I am downloading before sending it to the user? 3) How to send the file to the user? I haven't understood very well what you mean with "set the contenttype"...I need some more explanation...:-( Can you give me some little piece of codes for example, please? Thanks a lot! Luca -----Messaggio originale----- Da: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]Per conto di Raghupathy, Gurumoorthy Inviato: marted́ 10 settembre 2002 11.30 A: [EMAIL PROTECTED] Oggetto: Re: How can I downlod a (pdf) file using a servlet? Look at HTTPUrlConnection ( if using http ) or HttpsURLConnection. ( JSSE ) ... get the file .. and then set the contenttype ( and send it back to the client on the fly )..... Regards Guru -----Original Message----- From: Luca Ventura [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 10:18 To: [EMAIL PROTECTED] Subject: How can I downlod a (pdf) file using a servlet? Hello everybody! I have problem: I have a web-site where there is a servlet running....let's suppose the servlet name is "MyServlet". Some users can connect to the web-site and request to the servlet to download a .pdf file (but the file type is not important and could be different). The file name is passed to the servlet sending a parameter, for example connecting to the url: http://mydomain.com//MyServlet?FileName=File.pdf Note that the requested file is on a different web-site (let's suppose http://otherdomain.com) and the servlet must connect to this other site and download the file requested ("File.pdf") before sending it back to the user. That I need to know is: 1)How can I download a file from another site using a servlet? I mean....Which java code must I add to my servlet to do this? 2)Before sending the file to the user who requested it must I save it on disk or can I send it to the user "on the fly"? 3)How can I send the file from the servlet to the user that requested it? I hope someone can help me! Thanks a lot in advance. Luca ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html