留言板
Liferay 6.2 + Primefaces 6 + File Download
Deniz Burucu,修改在7 年前。
Liferay 6.2 + Primefaces 6 + File Download
New Member 帖子: 10 加入日期: 15-6-10 最近的帖子
I have a button to download in view:
In DownloadController:
How can I break a download action?
I am checking the restrictions for the user and file etc. If I return null, Liferay reload page and its only shown partially and without css.
If I return the File, everything is ok.
How can I write it correctly?
<p:commandlink value="Download" ajax="false" styleclass="btn btn-primary">
<p:filedownload value="#{DownloadController.downloadFile()}" />
</p:commandlink>
In DownloadController:
@ViewScoped
@ManagedBean(name = "DownloadController")
public class DownloadController {
...
public StreamedContent downloadFile() throws Exception {
//check file and restrictions
bAllowed = false;
if (!bAllowed) {
return null;
}
//prepare file to download
...
//send file to user
}
...
How can I break a download action?
I am checking the restrictions for the user and file etc. If I return null, Liferay reload page and its only shown partially and without css.
If I return the File, everything is ok.
How can I write it correctly?
Neil Griffin,修改在7 年前。
RE: Liferay 6.2 + Primefaces 6 + File Download
Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
I recommend that you try the accepted answer to the StackOverflow question titled Primefaces filedownload error handling.