public XLSAttachment onActionFromDownloadResult(Long id) {
if (id != null) {
AnalysisEntity analyis = analysisDao.findByAnalysisId(id);
if (analyis != null) {
String filename = excel.prepareResultSheet(analyis);
InputStream stream = new FileInputStream(filename);
return new XLSAttachment(stream, analyis.getTopic()
.getName()
+ "-results", analyis.getResultfile()
.getContenttype());
}
}
This action link works like a charm but i tried to automate the excel download a little bit by providing an additional IFRAME element:
<iframe width="1" height="1" src="${downloadLink}" />
public String getDownloadLink() {
Link download = resources.createEventLink("downloadResult", analysisEntityId);
return download.toString();
}
For some reason this link does not provide the same URL like the action link above:
ActionLink: ../resultpage.downloadresult?t:ac=10
download Link: ../resultpage:downloadresult?t:ac=10
The difference is the colon in the programmatically generate URL. Due to the IFRAME element, the browser tries to access this link but then Tapestry drops an exception about a missing event handler for that link.
What is the right way to provide a link to the ActionLinks action handler?
Regards,
Ralf