Sto cercando di visualizzare dinamicamente un'immagine in primefaces utilizzando il p: tag graphicImage come segue:Errore nello streaming di una risorsa dinamica. Utilizzando p: graphicImage con primefaces
<p:graphicImage value="#{submissionBean.contestImage}">
<f:param name="imageName"
value="#{contestBean.createContest.submissions[0].fileName}" />
</p:graphicImage>`
Il bean gestito è la seguente:
@ManagedProperty("#{param.imageName}")
private String imageName;
public String getImageName()
{
return imageName;
}
public void setImageName(String imageName)
{
this.imageName = imageName;
}
private StreamedContent contestImage;
public StreamedContent getContestImage()
{
FacesContext context = FacesContext.getCurrentInstance();
if (imageName == null)
imageName = Constants.SUBMISSION_FILE_DIR + "/" + "sacxzx_asdsdaas_icon.png";
if (context.getRenderResponse())
{
// So, we're rendering the view. Return a stub StreamedContent so
// that it will generate right URL.
return new DefaultStreamedContent();
}
else
{
return new DefaultStreamedContent(this.getClass().getResourceAsStream(Constants.SUBMISSION_FILE_DIR + "/" + imageName));
}
}
I ricevo sempre l'errore "SEVERE: Errore nello streaming di risorse dinamiche".
Controllo del URL dell'immagine sembra più che bene:
http://localhost:8080/mashup/javax.faces.resource/dynamiccontent.xhtml?ln=primefaces&pfdrid=pfdrid_4290aa0c-8eef-45ea-a281-638e460e33bf&imageName=sacxzx_asdsdaas_icon.png
Qualsiasi idea del perché questo è?
Grazie!
Quale ambito è il bean gestito? – wrschneider
Richiesta Scoperta. – Graeme