I have a download picture link which take a bit of time. Result is that the
user is impatiently clicking several time. I would like to have a kind of
timer showing process and I tried to use IndicatingAjaxLink which does the
job. But I cant find out to stream to the outputstream with an ajax link.
I tried both to get outputStream from ajax target.
public void onClick(AjaxRequestTarget target) {
target.getHeaderResponse().getResponse().getOutputStream();
...
or from a new target on requestCycle from page
public void onClick(AjaxRequestTarget target) {
public void onClick(AjaxRequestTarget target) {
target.getHeaderResponse().getResponse().getOutputStream();
target.getPage().getRequestCycle().setRequestTarget(new
IRequestTarget(){
public void respond(RequestCycle requestCycle) {
((WebResponse)requestCycle.getResponse()).getOutputStream();
...
None works ... Any advice ? Something with resources maybe ?
Here is the onClick method with a normal link.That works fine.
public void onClick()
{
final byte[] bytes = getDirectDownloadBytes(phot);
if(bytes != null && bytes.length > 0) {
getRequestCycle().setRequestTarget(new IRequestTarget()
{
public void respond(RequestCycle requestCycle) {
WebResponse r =
(WebResponse)requestCycle.getResponse();
r.setAttachmentHeader(fileName);
try {
r.getOutputStream().write(bytes);
} catch (IOException e) {
throw new RuntimeException(e);
} finally { }
}
});
}
}
--
View this message in context:
http://www.nabble.com/stream-content-with-an-IndicatingAjaxLink-tp17316702p17316702.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]