Link to home
Start Free TrialLog in
Avatar of vcsrinath
vcsrinath

asked on

Download problem

Hi,
i have a problem when i implement the download code in JRun and in weblogic.

It is perfectly working in iPlanet.

the code is this only...



public void download(String strSaveAsfilename,String strFilename,HttpServletResponse res,HttpServletRequest req) throws  ServletException, IOException
{
    ServletOutputStream out= res.getOutputStream();
   res.setContentType("application/octet-stream; name="+strSaveAsfilename+"");
   res.setHeader("Content-Disposition","inline;filename="+strSaveAsfilename+"");
     
     try{
           ServletUtils.returnFile(strSaveAsfilename,out);
        }
        catch(FileNotFoundException fnfe){}
    out.flush();
    out.close();
}


ServletUtils is the class which is used to read the contents and write it.

The actual problem is
1. illegal state exception is thrown at the very first line itself.
ServletOutputStream out= res.getOutputStream();

How to solve this?

Expecting a solution as early as possible.
Thanx in advance,
SrinathR
Avatar of fontaine
fontaine

Could you post the whole servlet code, or at least the init, doGet and/or doPost sections?
Avatar of Mick Barry
Sounds like res.getOutputStream() has already been called.
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQ'ed and points NOT refunded

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial