M
MileHighCelt
I am getting an Outputstream already obtained when my Action passes the
HttpServletResponse to another method, which then does:
response.setContentType("text/csv");
response.setHeader("Content-disposition",
attachment.toString());
response.setHeader("Pragma", null);
response.setHeader("Cache-Control","no-store");
....
OutputStream os = response.getOutputStream();
....
os.write(s.getBytes()); // where s is a String;
then it writes some strings to that stream. The problem seems to
be that somewhere after this code the IllegalStateException is being
thrown. I am trapping it in my code but it isn't occuring there.
So my question is, what is the preferred method of returning a file for
the user to download when they click a button/link to trigger this
action? Is struts already using the HttpServletResponse and triggering
all these exceptions?
HttpServletResponse to another method, which then does:
response.setContentType("text/csv");
response.setHeader("Content-disposition",
attachment.toString());
response.setHeader("Pragma", null);
response.setHeader("Cache-Control","no-store");
....
OutputStream os = response.getOutputStream();
....
os.write(s.getBytes()); // where s is a String;
then it writes some strings to that stream. The problem seems to
be that somewhere after this code the IllegalStateException is being
thrown. I am trapping it in my code but it isn't occuring there.
So my question is, what is the preferred method of returning a file for
the user to download when they click a button/link to trigger this
action? Is struts already using the HttpServletResponse and triggering
all these exceptions?