This works:
getWebRequestCycle().getWebResponse().setContentType("text/csv");
getWebRequestCycle().getWebResponse().setHeader("Content-Disposition",
"attachment;filename=\"export_" +
formatFile.format(Calendar.getInstance().getTime()) + ".csv\"");
OutputStream cout =
getWebRequestCycle().getWebResponse().getOutputStream();
cout.write(out.toString().getBytes());
cout.flush();
cout.close();
But I get this in the logs. How can I do this better?
16:31:45,391 ERROR WebResponse:190 - Unable to redirect to:
?wicket:interface=:2::::, HTTP Response has already been committed.
Stanczak Group wrote:
This maybe? Should I be using "getWebRequestCycle().getWebResponse()"
instead of "getResponse()."?
getWebRequestCycle().getWebResponse().setHeader()
Stanczak Group wrote:
How can I do this in Wicket? I'm writing a csv generated file to the
output, but I don't know how to tell the client what file name to
use. This is what I was using before, is there another way?
getResponse().setHeader("Content-Disposition",
"attachment;filename=\"export_" +
formatFile.format(Calendar.getInstance().getTime()) + ".csv\"");
############################Code##############################################
getResponse().setContentType("text/csv");
getResponse().setHeader("Content-Disposition",
"attachment;filename=\"export_" +
formatFile.format(Calendar.getInstance().getTime()) + ".csv\"");
OutputStream cout =
getResponse().getOutputStream();
cout.write(out.toString().getBytes());
cout.flush();
cout.close();
--
Justin Stanczak
Stanczak Group
812-735-3600
"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]