How to control File Download window

I am using javax.servlet.ServletOutputStream for downloading the files. I am reading the InputStream from data base and writing into the ServletOutputStream object. I set the HttpServletResponse content type to "application/octet-stream".
When I tried to download the file, the browser(IE) displaying the File Download window that consist of Name, Type and From details. How can I set the values for Name, Type and From fields. Also is it possible to customize the buttons like Open, Save, Cancel on this File Download window.
Any help will be heighly approciated.
Regards
Venkat

this is simple code for downloading , if you don't get desired results then specify ur problem in detail
package p1;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Download extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
res.setContentType("text/html");
ServletContext ctx=getServletContext();
InputStream is=ctx.getResourceAsStream("/xyz.jar");
int read=0;
byte []bytes=new byte[1024];
OutputStream os=res.getOutputStream();
while((read=is.read(bytes))!=-1)
os.write(bytes,0,read);
os.flush();
os.close();
}

Similar Messages

  • TS3212 I get the file download window and I push "run", but after it starts to install, I get a window that says that they was a problem with the installation and I need to check with the manufacturer of my software. WHat does that mean?

    I get to the file download window to install itunes and push run, but after it starts to install, it stops and I get an error message that installation can no continue and everything is uninstalled. It tells me to check with my software company to resolve. What does that mean?

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START > CONTROL PANEL > Add n Remove Programs / highlight ASU and click CHANGE then REPAIR,

  • How many control files will be present in a database?

    How many control files will be present in a database?

    See this link for control file recommendations
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm
    See the portion "Control Files Overview" and the last "Multiplexed Control Files"
    Don't forget to reward points if this answer your query.

  • In the jspdynpage how to implements file download!!!!

    in the jspdynpage how to implements file download!!!!
    in the portal's view i need to implements download file like *.xls,i don't know how to do. and if servlet can be used in the portal application!
    Edited by: xuhuanjun on Apr 8, 2009 9:57 AM

    Hi,
    Check the below thread that will help you.
    How to get a file download window using URL component in HTMLB/JSPDynpage
    Raghu

  • Open file-download window from servlet

    Hi all,
              This is the scenario I'm trying to achieve:
              - Display html page with a button or href "download csv file"
              - the user clicks
              - the file-download pop-up window should appear,so the user can save the
              file at any location
              This is how far I get:
              - when the user clicks a servlet gets activated
              - Servlet:
              - creates the csv file and write it to disk
              - now I want the servlet to do something so that the file-download window
              opens
              - I've tried with forward the request to the url (which only displays the
              content in the browser)
              - I write to HttpServletResponse it opens the file in excel which I don't
              want
              Any ideas ?
              Thanks in advance
              Per
              

    Thanks Mettu,
              that worked fine.
              This is what the code looked like:
              ...Per
              ==========================================================================
              if (nextPage.getType()== Page.TYPE_CSV)
              String filePath = (String) req.getAttribute(Attribute.CSV_FILE_PATH);
              String fileName = (String)
              req.getAttribute(Attribute.CSV_FILE_NAME);
              file://Writing text file like this enforces fileDownload popup
              window
              res.setContentType("application/RFC822");
              res.setHeader("Content-Disposition", "attachment; filename=\"" +
              fileName);
              writeFileToOutStream(res,filePath,fileName);
              private void writeFileToOutStream(HttpServletResponse res,String
              filePath,String fileName) throws IOException
              OutputStream out1 = res.getOutputStream();
              FileInputStream fin = new FileInputStream(filePath + fileName);
              byte [] b = new byte[1024];
              int size = 0;
              while((size = fin.read(b, 0, 1024)) > 0)
              out1.write(b, 0, size);
              fin.close();
              out1.flush();
              out1.close();
              ==========================================================================
              "Mettu Kumar" <[email protected]> wrote in message
              news:[email protected]...
              > Per,
              >
              > For this to work in both Netscape and IE, You need You need to set
              content
              > Type and Also a header information.
              >
              > Set Content Type As : Content-type: application/RFC822
              > set the Header "Content-Disposition" to "attachment; filename=\"" +
              > youfilename + "\""
              > Where youfilename is the name of the file you display to
              user.
              >
              > If you want the exact java code use the following two lines of code in
              your
              > servlet:
              > res.setContentType("Content-type: application/RFC822");
              > res.setHeader("Content-Disposition", "attachment; filename=\"" +
              youfilename
              > + "\"");
              >
              >
              > This should solve your problem.
              >
              >
              > Kumar.
              >
              > Per Lovdinger wrote:
              >
              > > Hi all,
              > >
              > > This is the scenario I'm trying to achieve:
              > >
              > > - Display html page with a button or href "download csv file"
              > > - the user clicks
              > > - the file-download pop-up window should appear,so the user can save
              the
              > > file at any location
              > >
              > > This is how far I get:
              > > - when the user clicks a servlet gets activated
              > > - Servlet:
              > > - creates the csv file and write it to disk
              > > - now I want the servlet to do something so that the file-download
              window
              > > opens
              > >
              > > - I've tried with forward the request to the url (which only displays
              the
              > > content in the browser)
              > > - I write to HttpServletResponse it opens the file in excel which I
              don't
              > > want
              > >
              > > Any ideas ?
              > > Thanks in advance
              > > Per
              >
              

  • How to share files with windows xp

    how to share files with windows xp

    stephenfromdagenaham wrote:
    how to share files with windows xp
    If you mean just moving files between a Mac and a PC with XP on it, get a USB flash drive, format it FAT32 (they usually come that way) and copy the files to that drive.

  • How to transfer files from windows 7 to macbook pro

    how to transfer files from windows 7 pc to my new macbookpro

    You can use your external hard drive that is used to backup your important data to transfer the data from your PC to your Mac.
    If your Windows 7 PC is a laptop and you live near an Apple store, make an appointment at the Genius bar where they will help you transfer the data you want transferred from your PC to your MBP.

  • The file download window keep coming up wheneven i...

    Wheneven i opened the skype, it will come out a file download asking me to open or save the index.html or chatwidget.html and recently skype require me to change password so after that i cant log in anymore because everytime i go inside if i click cancel in the file download window, the skype will go blank, or if opened the file then the log in page picture will appear in google chrome website which i still cant find a way to log in. Its not only Skype that i got this problem, even i opened other apps, the file download window will keep coming up too. 
    Solved!
    Go to Solution.
    Attachments:
    skype.png ‏148 KB

    What is the version of Internet Explorer installed on your computer?
    In Internet Explorer go to Help -> About Internet Explorer.
    Skype login screen is created using the index.html file, which is accessed using Internet Explorer components installed on your computer.
    P.S. Please, don’t say that you are not using Internet Explorer. This is irrelevant. Skype depends on Internet Explorer.

  • How open xmp file in window 7

    When I do post processing by Raw, XMP file automatically created.
    1.How open this file in window 7?
    2. I need keep this file because I have same file in Adobe 12?
    3. What happened if delete it?
    4. If it not need how prevent to created it?

    Also before go to any adjustment we can ( I always do)   made copy or duplicate the  original and working with the copy.
    This is completely unnecessary.
    Adobe software never overwrites or modifies your RAW files. (Not true for original JPG files, in which case Adobe software could overwrite the original JPG file)
    It has nothing to do with saving as DNG or saving as JPG. Furthermore, if you are editing a RAW, in general I see no point to save it as a DNG, when saving it as a RAW by clicking on "DONE" accomplishes the same thing.

  • How to get file download dialog box in IE 6.0 for .CSV files?

    In our Java application, when we download .csv file (by clicking a tool bar button or menu item) in IE 5.5, it brings up the download dialog box and when we click the open button it opens the file in a seperate browser window but after migrating to IE 6.0 it doesn't bring the download dialog box and we are not able to open the excle sheet in a new browser window.
    We tried downloading .csv file in IE 6.0 by changing its extension(such as .cs1 and .xls) even then it did not work.We also tried associating CSV type of extension with "Microsoft Excel Comma Separated Values File" in the Windows folder options (Windows Explorer->tools->folder options->file types(tab)), which did not work.
    Please respond if you have come across this kind of issue and solution for the same.
    Thanks in Advance

    This has nothing to do with Java. It's Microsoft
    setting for known file type. IE is responding to the
    setting which will automatically download known file
    type (MIME type).
    To show the "Save As" file dialog, you have to do the
    following (for each file type)
    1. open Window Explorer
    2. click on Tool-->"Folder Option"
    3. click on the "File Type" tab
    4. select the extension and then click on the
    "Advance" button
    5. Check the "Confirm open after download" checkbox
    6. Click OK
    IE should now display the "Save As" file dialog for
    that extension. Remeber, you have to to this for all
    extension you want to see a "file dialog" pop up.Unfortunately this is not the only cause. Even with this box checked, downloading java source files from the pages of The Java Tutorial causes them to open in the most recent IE - I (and others also) don't get the save/open dialog box. Java source files downloaded from (some) other websites result in the save/open dialog box. I believe that one of the security changes that MS made in IE's handling of files is the cause. The setting of content-disposition by the server appears to be the key, according to MSDN information.

  • How to transfer files from windows interface to mac interface?

    it's easy to transfer files from mac to windows by dragging them to the windows harddisk icon.How to do this under windows?

    hello!i did not see the mac harddisk icon under my windows interface.where can i find it?thanks!

  • How many control file should be created in ASM for ORACLE 4 nodes RAC

    We have a oracle 10G(10.2.0.4) database with 4 nodes locates ASM in redhat linux5.
    The vendor created this RAC system with database.
    I saw below infornation as
    SQL> select name from GV_$CONTROLFILE;
    NAME
    +FLSDISK1/sale/controlfile/current.256.690290159
    +FLSDISK1/sale/controlfile/current.256.690290159
    +FLSDISK1/sale/controlfile/current.256.690290159
    +FLSDISK1/sale/controlfile/current.256.690290159
    It seems that each node with one control file.
    I got a feedback that vender claimed SAN is very reliable.
    I am new person for database at ASM for RAC.
    Could you make a explain for this condition? Do I need to add ( mirror) another 2 control file into ASM?
    The Oracle recommands that at least 2 contril files( best 3 files) in different place. This is true for signle instance.
    How about RAC that database locates in ASM?
    Please help me!!
    Jim

    You are fine using the standard three controlfiles in ASM, four is fine too, but it does not need to be tied to the number of instances as all the instances in a RAC database use the same controlfile (and its copies). ASM knows the controlfile type and will stripe each one in 128k pieces across as many volumes as it can. I much prefer to have my controlfiles in ASM, it prevents accidental deletion and generally makes DBA life easier.
    Cheers!
    Jay Caviness
    http://www.grumpy-dba.com

  • How to transfer files from windows to iMac

    I just bought an imac today and wondering if its possible to transfer all my files from windows to imac?
    Thanks

    Yes. You'll be given the option to migrate your data from it while setting up the iMac.
    (101966)

  • Opening any email in outlook now produces a "file download" window asking if I want to open or save this html file. The file type is always a (different) Firefox document. How do I stop this?

    This happens every time an email is opened, regardless of whether there is a file attachment and regardless of whether Firefox is running.

    Deleted it, restarted it. tried it again. no change. repeated the whole cycle. no change. thinking about uninstalling and reinstalling, but that won't reallyk change the settings.

  • How to control File read Proxy Service when it is polling from folder?

    Hello all,
    In my current requirement we are receiving  xml's through one folder(LOCAL) from source side.we are picking those xml's  by proxy service PS1  as file transport for every 10 sec and configured that folder path.In PS1 message flow we put on routing action to one bussiness service,that business service sending those xml's to one MQ.
    We already created this interface but the issue is source side they plan to change that folder and also they want to stop this service(folder to MQ) sometimes based on synarios.That folder will be delete or if exist proxy wont read messages from that folder.
    But proxy is still looking for that folder in Test ENV on Unix system then it gives error beacuse of unix folder structure is different,proxy unable to create that folder in unix system.it is creating in windows.
    Now we want to control that service when the folder is ready that time only  proxy will activate otherwise not..i.e like if condition "if cndtion is satisfied PS1 starts the polling from that folder else condition should be work.
    How can i control PS1 service?
    Is there any chance to control by using another proxy?
    Experts please guide me..
    regards
    venu

    Hi Terry,
    According to your description, my understanding is that you don’t want the yollow bar notification to display when you open Access documents.
    This issue seems to be about the client application. Please compare the followings with the things that you did:
     1.Open the documents
     2.Click File->Options->Trust Center->Trust Center Settings
     3.Click Protected View, unselect ‘Enable Protected View for originating from the Internet’
     4.Click Message Bar, select ‘Never show information about blocked content’
     5.Click Macro Settings, select ‘Disable all macros without notification’
    In addition, as this issue is about Office, I commend you create a new thread in Office forum, more experts will assist you with this issue.
    Office forum:
    http://social.technet.microsoft.com/Forums/en-US/home?category=officeitpro
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for