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 <[email protected]>
To: Struts Users Mailing List <[email protected]>
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, <[email protected]>
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 ·
[email protected]
>
> 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.