简体   繁体   English

在OAF中完成操作后如何终止http会话

[英]how to kill http session after action completes in OAF

I am calling one action for csv download in IE9 using OAF framework. 我正在使用OAF框架在IE9中调用csv下载的一项操作。

After processing gets completed, browser is showing the csv to Save or Download. 处理完成后,浏览器将显示要保存或下载的csv。

But, problem is my browser gerts hanged with processing mouse sign,for which I have to press F5 to kill the session. 但是,问题是我的浏览器虫子因处理鼠标标志而挂死,为此,我必须按F5键才能终止会话。

Then browser is allowing me to Open/Download the CSV file. 然后浏览器允许我打开/下载CSV文件。

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. 可能的问题是,我可以像使用OAF一样在浏览器级别关闭会话,并且我的代码中没有使用javascripts代码。

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. 重要的部分是完成工作后如何处理HttpServletResponse。
Try the below code along with your try-catch block: 尝试下面的代码以及try-catch块:

InputStream in = null;

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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