Hi!
I have a form inside a ModalWindow. When user submit the form I want to
close to window
and stream pdf.
I tried:
setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
public void onClose(AjaxRequestTarget target) {
RequestCycle.get().setRequestTarget(new
IRequestTarget() {
public void detach(RequestCycle requestCycle) {
}
public void respond(RequestCycle requestCycle) {
MyPpdf pdf;
try {
pdf = new MyPpdf();
WebResponse webResponse
= (WebResponse) requestCycle.getResponse();
webResponse.setAttachmentHeader("pdf_" + System.currentTimeMillis() +
".pdf");
webResponse.setContentType("application/pdf");
pdf.genPdf().writeTo(webResponse.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
});
but it doesn't work.
I tried this too:
setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
public void onClose(AjaxRequestTarget target) {
try {
ResourceStreamRequestTarget pdfTarget =
new
ResourceStreamRequestTarget(new FileResourceStream(new
File("MyPdfFile.pdf")));
RequestCycle.get().setRequestTarget(pdfTarget);
} catch (Exception e) {
e.printStackTrace();
}
}
});
In both cases I've got an error in Firefox console:
Error: not well-formed
Source File: http://127.0.0.1:8080/myapp/wickete/page
Line: 1, Column: 9
Source Code:
%PDF-1.4--------^
Thanks for help in advance,
Artur
--
View this message in context:
http://www.nabble.com/Stream-resource-on-setWindowClosedCallback-tp14706092p14706092.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]