Re: IllegalStateException
От: LobnYA  
Дата: 20.12.07 05:55
Оценка:
Здравствуйте, oson, Вы писали:

O>
O>  private void showReport(ReportProvider reportProvider, HttpServletResponse response, String nameForStore) throws IOException
O>  {
O>      byte[] reportContentInBytes = myBean.getBytes();
O>      String format = myBean.getFormat();
O>      String ext = null;
O>      if (format.equalsIgnoreCase("application/pdf"))
O>      {
O>          ext = ".pdf";
O>      }
     

O>      if (reportContentInBytes != null && nameForStore != null && ext != null)
O>      {
O>          response.setContentType("application/x-download");
O>          response.setContentLength(reportContentInBytes.length);
O>          response.setHeader("Content-Disposition", "attachment; filename=" + nameForStore + ext);
O>          OutputStream outputStream = response.getOutputStream();
O>          outputStream.write(reportContentInBytes, 0, reportContentInBytes.length);
O>          outputStream.flush();
O>          outputStream.close();
O>      }
O>  }

O>


может причина в том, что ты пытаешься взять OutputStream после того как уже установил что-то в response?
попробуй сделать OutputStream outputStream = response.getOutputStream() до response.set...
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.