primefaces 5.3 pe 4.0
i am using the document viewer to display a pdf using streamed content but it is showing me and empty file.
opening the page and getting the streamed content
<h:commandLink actionListener="#{meetBean.previewbuttonAction}" action="meetingpreview.xhtml" target="_blank">
<f:attribute name="attachment" value="#{meetattachment}"></f:attribute>
preview</h:commandLink>
making streamed content from file
public void previewbuttonAction(ActionEvent actionEvent) throws IOException {
Meetingsattachment ma=(Meetingsattachment) actionEvent.getComponent().getAttributes().get("attachment");
try{
InputStream stream = new FileInputStream(new File(ma.getAttachment()));
setStreamed(new DefaultStreamedContent(stream));
}
catch(NullPointerException ne){
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("File Unavailable") );
}
}
document viewer
<pe:documentViewer value="#{meetBean.streamed}" height="500"></pe:documentViewer>
but all it is showing me is an empty document
the file location is correct /path/to/files/t1-1323583810/1.pdf, i am doing everything exactly like in the showcase so i am not sure how to debug this and move forward