Adam, The control is out of the action class and if the user will open or save the file, there is no problem and the control goes to the JSP page. For some reason once the error occurs if the user clicks another button that makes AJAX call to server, the call does not go through but instead returns cashed results from the previous AJAX call.
Thanks, Lana. From: adam pinder <apin...@hotmail.co.uk> To: <user@struts.apache.org> Date: 04/11/2012 01:46 PM Subject: RE: struts2 problem when file download dialog is closed is the user "cancelling" still sending a request to the server and hence you are trying to return an error - if so i'd assume the http connection has been terminated and therefore you can't send an http response back. if its just logged but doesn't stop user experience then leave it. > To: user@struts.apache.org > Subject: Re: struts2 problem when file download dialog is closed > From: svetlana.roslyak...@bnymellon.com > Date: Wed, 11 Apr 2012 09:51:39 -0400 > > Venkata, > > I use Struts2 2.2.1.1 version. > I've changed the filter to StrutsPrepareAndExecute Filter. > > The same error: > > Servlet failed with Exception > java.lang.IllegalStateException: Response already committed > at > weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(Servl > etResponseImpl.java:1422) > at > weblogic.servlet.internal.ServletResponseImpl.sendError(ServletRespon > seImpl.java:580) > at > org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:77 > 1) > at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.jav > a:506) > at > org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(Exec > uteOperations.java:77) > Truncated. see log file for complete stacktrace > > > > Muneer, > > When the user closes dialog the control goes to jsp page, but the behavior > is strange as when I try subsequently to do AJAX call, it does not go to > the server, but instead uses the cashed response. > > Thanks, > > Lana. > > > > > > > From: vEnkaTa mohAna rAo SriperumbUdUru <mohanara...@gmail.com> > To: Struts Users Mailing List <user@struts.apache.org> > Date: 04/10/2012 09:19 PM > Subject: Re: struts2 problem when file download dialog is closed > > > > You are using older version Struts2.x and change filter to > StrutsPrepareAndExecute Filter. > > > On Wed, Apr 11, 2012 at 1:59 AM, <svetlana.roslyak...@bnymellon.com> > wrote: > > > Hi, > > > > I've created a struts2 application that creates text file and displays > the > > file download dialog for the user to open or save it. > > It works fine if the user opens or saves it, but if the user closes the > > file download dialog the program logs the following error: > > > > Servlet failed with Exception > > java.lang.IllegalStateException: Response already committed > > at > > weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(Servl > > etResponseImpl.java:1422) > > at > > weblogic.servlet.internal.ServletResponseImpl.sendError(ServletRespon > > seImpl.java:580) > > at > > org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:77 > > 1) > > at > > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.jav > > a:506) > > at > > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatc > > her.java:395) > > Truncated. see log file for complete stacktrace > > > > > > > My struts.xml file code is as follows: > > > > <action name="AdmExport" class="ConfigAction" method="export"> > > <result name="success" type="stream"> > > <param name="contentType">application/octet-stream</param> > > <param name="inputName">inputStream</param> > > <param > > name="contentDisposition">attachment;filename="tempExport.txt"</param> > > <param name="bufferSize">1024</param> > > </result> > > </action> > > > > My action class code is as follows: > > > > import org.apache.struts2.interceptor.SessionAware; > > import com.opensymphony.xwork2.ActionContext; > > import com.opensymphony.xwork2.ActionSupport; > > > > > > public class ConfigAction extends ActionSupport implements SessionAware > > { > > > > public void setInputStream(InputStream inputStream) { > > this.inputStream = inputStream; > > } > > public InputStream getInputStream() { > > return inputStream; > > } > > > > public String export() throws Exception { > > > > try > > { > > // code to create tempExport.txt file > > > > File exportFile = new File("./tempExport.txt"); > > setInputStream(new FileInputStream(exportFile)); > > exportFile.delete(); > > } > > catch (Exception ex) > > { > > ex.printStackTrace(); > > } > > > > return SUCCESS; > > } > > } > > > > Any ideas as how to fix the issue will be greatly appreciated. > > > > Thanks, > > > > Svetlana Roslyakova · The Bank of New York Mellon > > Regulatory Systems · Tel 212.815.8043 · > svetlana.roslyak...@bnymellon.com > > > > The information contained in this e-mail, and any attachment, is > > confidential and is intended solely for the use of the intended > recipient. > > Access, copying or re-use of the e-mail or any attachment, or any > > information contained therein, by any other person is not authorized. If > > you are not the intended recipient please return the e-mail to the > sender > > and delete it from your computer. Although we attempt to sweep e-mail > and > > attachments for viruses, we do not guarantee that either are virus-free > and > > accept no liability for any damage sustained as a result of viruses. > > > > Please refer to http://disclaimer.bnymellon.com/eu.htm for certain > > disclosures relating to European legal entities. > > > The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. If you are not the intended recipient please return the e-mail to the sender and delete it from your computer. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses. > > Please refer to http://disclaimer.bnymellon.com/eu.htm for certain disclosures relating to European legal entities. The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. If you are not the intended recipient please return the e-mail to the sender and delete it from your computer. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses. Please refer to http://disclaimer.bnymellon.com/eu.htm for certain disclosures relating to European legal entities.