Forums de discussion
Liferay 6.2 + Primefaces 6 + File Download
Deniz Burucu, modifié il y a 7 années.
Liferay 6.2 + Primefaces 6 + File Download
New Member Publications: 10 Date d'inscription: 10/06/15 Publications récentes
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, modifié il y a 7 années.
RE: Liferay 6.2 + Primefaces 6 + File Download
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
I recommend that you try the accepted answer to the StackOverflow question titled Primefaces filedownload error handling.