Hmm, this is what strikes me odd about your approach in your link's
onSubmit():
public void onClick(AjaxRequestTarget target) {
// I get it, you're creating your own stream writer
AbstractResourceStreamWriter rstream = new
AbstractResourceStreamWriter() {
public void write(Response output) {
output.write(MyPDFSharedResource.getPDFBytes());
}
};
// and your resource handler
ResourceStreamRequestHandler handler = new
ResourceStreamRequestHandler(rstream, MyPDFSharedResource.getFileName());
handler.setContentDisposition(ContentDisposition.ATTACHMENT);
// and you schedule it
getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
// But what are you doing now?
String url = MyPDFSharedResource.getUrl();
target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\",
100);");
}
Why are you using Ajax here to redirect the browser and why not just simply
respond to the client directly with your PDF resource?
Why not just simply implement
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/Response.html
and then grab a hold of the
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/cycle/RequestCycle.html
and call its setResponse(Response response)?
I forgot how I did this, but I'm sure I must have used an implementation of
a Reponse and then responded the the onClick() via
RequestCycle.setResponse(new MyRespone()). I query the database, parse some
data into CSV and Exel files and then server them to the client browser. I
also do this when I package a windows installer and server the MSI as a byte
array in MyResponse.
If you want a code snippet example let me know...
-----
~ Thank you,
[email protected]
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/IResourceStream-from-ByteArrayResource-tp4652776p4652814.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]