java - Exception when downloading huge files using struts framework -
sorry if question similar other present, posting none of solutions offered have worked me.
i have struts action of type 'stream' called download, leads downloading file website(running in https).
code:
inputstream inp; public string execute { inp = //get inputstream; return success; } struts <action name="download" class="abc"> <result name="success" type="stream"> <param name="contenttype">application/octet-stream</param> <param name="inputname">inp</param> <param name="contentdisposition">attachment;filename="abc"</param> <param name="buffersize">1024</param> </result> </action>
for downloading large files across browsers, throws exception :
java.lang.illegalstateexception: getoutputstream() has been called response @ org.apache.catalina.connector.response.getwriter(response.java:611) @ org.apache.catalina.connector.responsefacade.getwriter(responsefacade.java:198) @ javax.servlet.servletresponsewrapper.getwriter(servletresponsewrapper.java:122) @ org.apache.jasper.runtime.jspwriterimpl.initout(jspwriterimpl.java:125) @ org.apache.jasper.runtime.jspwriterimpl.flushbuffer(jspwriterimpl.java:118) @ org.apache.jasper.runtime.pagecontextimpl.release(pagecontextimpl.java:180) @ org.apache.jasper.runtime.jspfactoryimpl.internalreleasepagecontext(jspfactoryimpl.java:118) @ org.apache.jasper.runtime.jspfactoryimpl.releasepagecontext(jspfactoryimpl.java:77) @ org.apache.jsp.shared.baseerror_jsp._jspservice(baseerror_jsp.java:87) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:820) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:646) @ org.apache.catalina.core.applicationdispatcher.doinclude(applicationdispatcher.java:551) @ org.apache.catalina.core.applicationdispatcher.include(applicationdispatcher.java:488) @ org.apache.tiles.servlet.context.servlettilesrequestcontext.include(servlettilesrequestcontext.java:217) @ org.apache.tiles.servlet.context.servlettilesrequestcontext.dispatch(servlettilesrequestcontext.java:177) @ org.apache.tiles.context.tilesrequestcontextwrapper.dispatch(tilesrequestcontextwrapper.java:72) @ org.apache.struts2.tiles.strutstilesrequestcontext.dispatch(strutstilesrequestcontext.java:88) @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:606) @ org.apache.tiles.impl.basictilescontainer.render(basictilescontainer.java:246) @ org.apache.struts2.views.tiles.tilesresult.doexecute(tilesresult.java:105) @ org.apache.struts2.dispatcher.strutsresultsupport.execute(strutsresultsupport.java:186) @ com.opensymphony.xwork2.defaultactioninvocation.executeresult(defaultactioninvocation.java:373) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:277) @ org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:52) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:498) @ org.apache.struts2.dispatcher.filterdispatcher.dofilter(filterdispatcher.java:434) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ java.security.accesscontroller.doprivileged(native method) @ javax.security.auth.subject.doas(subject.java:415) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:563) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:615) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) @ org.apache.coyote.http11.http11processor.process(http11processor.java:861) @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:606) @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) @ java.lang.thread.run(thread.java:724)
after exception occurs, file download stops in between , user has incomplete file.
when google issue, see many people have faced similar issue, esp ie, none of solutions offered seem apply case(i facing issue across browsers).
Comments
Post a Comment