Trevor Campbell wrote:
I am having trouble working out how to download a dynamically
generated file.
I have a simple form that captures and number of pieces of information
and then generates a piece of text that I want to send to the user as
a text file download.
The form is a standard Form in a page extending WebPage.
Following the Upload/Download page in the wiki, I have created a
resouce extending DynamicWebResource, but cannot see how to redirect
to it.
I would normally just do a setResponsePage(new MyPage("dshs")) but
that doesn't work as the resource is not a Page.
How do I redirect to send My resource? (I don't want to store the
file and make the user click a link and all that stuff)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
I was able to solve my issue by ignoring all the stuff in the wiki about
upload/download and just doing the following
setRedirect(false);
WebResponse response = (WebResponse) getResponse();
response.setAttachmentHeader("nyFile.txt");
response.setContentLength(myText.length());
response.setLastModifiedTime(Time.now());
response.setContentType("text/plain");
response.write(myText);
response.close();
I am not sure if it is the most elegant but it works for me.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org