简体   繁体   中英

how to kill http session after action completes in OAF

I am calling one action for csv download in IE9 using OAF framework.

After processing gets completed, browser is showing the csv to Save or Download.

But, problem is my browser gerts hanged with processing mouse sign,for which I have to press F5 to kill the session.

Then browser is allowing me to Open/Download the CSV file.

The prob is ,I am able to close the session at browser level as I have been using OAF and no javascripts codes are being used in my code.

My code is as below:

HttpServletResponse response = 
   (HttpServletResponse)pageContext.getRenderingContext().getServletResponse();
   response.setContentType("text/csv");
   response.setHeader("Content-Disposition", 
   "attachment; filename=" + file_name + ".csv");

   ServletOutputStream pw = null; 

The important part is how you handle HttpServletResponse after your work is done.
Try the below code along with your try-catch block:

InputStream in = null;

finally
      {
        try
        {
          pw.flush();
          pw.close();
          if (in != null)
          {
            in.close();
          }
        }catch (Exception e)
        {
          e.printStackTrace();
        }
      }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM