-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Filippov, i think you'd better use the method
public java.io.PrintWriter getWriter() throws IOException; than getOutputStream(). Regards Volker Filippov, Andrey schrieb: > Hello everybody! > > I am trying to load file from DB. I use https. In Mozilla I get only one exception but everything finally works. Here is my code and stack trace: > > public String execute() throws Exception { > super.execute(); > > byte[] file = null; > PolicyFileVO policyFile = polInfoInstance.getPolicyFileById(fileId); > file = policyFile.getFile(); > String fileType = polInfoInstance.getFileTypeById(policyFile.getType()) > .getContentType(); > if (file != null) { > this.response.setCharacterEncoding("utf-8"); > > > String fileName = policyFile.getFile_name(); > > > if (!fileType.startsWith("image")) { > this.response.addHeader("Content-Disposition", > "attachment; filename=" + fileName); > } > // final ServletContext sc = ServletActionContext.getServletContext(); > this.response.setContentType(fileType); > this.response.setContentLength(file.length); > OutputStream o = null; > try { > o = response.getOutputStream(); > o.write(file); > o.flush(); > } catch (java.lang.IllegalStateException ex) { > log.error("IllegalStateException in FileContent.execute() method " + ex); > }catch (java.io.IOException ex) { > log.error("IOException in FileContent.execute() method " + ex); > }catch (java.lang.Exception ex) { > log.error("Exception in FileContent.execute() method " + ex); > }finally{ > if (o != null){ > response.flushBuffer(); > o.close(); > } > } > } > > > 16:52:20,832 ERROR [UIBean] error when rendering > java.lang.IllegalStateException: getOutputStream() has already been called for this response > at org.apache.catalina.connector.Response.getWriter(Response.java:604) > .......................................................................................... > 16:52:21,004 ERROR [[default]] Servlet.service() for servlet default threw exception > java.io.IOException: Error including path '/layouts/four_rows_layout.jsp'. java.lang.IllegalStateException: getOutputStream() has already been called for this response > at org.apache.tiles.servlet.context.ServletTilesRequestContext.include(ServletTilesRequestContext.java:214) > at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:183) > at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:417) > at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:368) > > And the second part of my problem happens only in IE6 - when dialog of opening/saving file instead of normal file name like myTest.pdf reflect the action name - something like this: FileContent_action?fileId=5046 (only when I use https - in http it looks fine - myTest.pdf). > > Could someone help me? > I appreciate in advance... > > > > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIDh4Ax4KjH6Tk4MMRAiMdAKDMB27Msv9kcSBMPwh7NxMbrze5PQCfSoS0 PQ4JTCCpJl/v671RQEsXlOQ= =yNby -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]