hi, sorry to keep nagging this subject but it doesnt seem to be working
for me.. I went to the archives and found some more helpful posts
including code. But when I implemented it, it didnt actually download the
file. Here's my servlet now:

public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException
{
        ObjectInputStream in = new ObjectInputStream(req.getInputStream());
        ObjectOutputStream out = new ObjectOutputStream(resp.getOutputStream());
        ServletOutputStream so = resp.getOutputStream();

        try{
                UserData data = (UserData)in.readObject();
                resp.setContentType("application/octet-stream; 
name="+data.getFileName());
                resp.setHeader("Content-Disposition","inline; 
filename="+data.getFileName());
                resp.setHeader("Content-encoding","binary");
               try {
                    //from oreilly package
                    ServletUtils.returnFile("/tmp"+data.getFileName(),so);
                } catch(FileNotFoundException fe) {
                    System.out.println("File not found");
                }
                out.writeObject("Done");

        }
        catch (java.lang.Exception ex)
        {A
            ex.printStackTrace ();
        }
        // Close the I/O streams
        in.close();
        out.close();

}

When run it finds the file, does nothing, then returns the 'Done',
when I exclude the ObjectOutputStream the servlet doesnt initialize or do
anything.
What am I not doing to get the file to download?

Thanks
Sohaila

___________________________________________________________________________
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

Reply via email to