I'm trying to display p:graphicImage with dynamic content. My view:
<p:graphicImage value="#{loginBean.loginImage}" />
Backing bean (Spring Bean / Singleton Scope)
public StreamedContent getLoginImage() throws IOException
{
if (FacesContext.getCurrentInstance().getCurrentPhaseId() == PhaseId.RENDER_RESPONSE)
{
return new DefaultStreamedContent();
}
String loginImage;
if (developmentState)
{
loginImage = "dev.jpg";
} else
{
loginImage = "prod.jpg";
}
final byte[] bytes = ... load bytes
return new DefaultStreamedContent(new ByteArrayInputStream(bytes), "image/jpg");
}
This works fine in Firefox / Chrome. But it fails in IE 10+ Instead of real image there is empty box rendered
My login page uses:
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</f:facet>
</h:head>
Page is rendered. Only image is missing in IE (Firefox / Chrome renders correctly). No errors on server side even with TRACE level enabled.
IE:
<img id="j_idt10" alt="" src="/appContext/javax.faces.resource/dynamiccontent.properties.xhtml?ln=primefaces&pfdrid=ufpDFHhNpCx9dNk92OfD7uAPP6LjduXzuDwZf73cSco%3D&pfdrt=sc&pfdrid_c=true">
Chrome:
<img id="j_idt10" src="/appContext/javax.faces.resource/dynamiccontent.properties.xhtml?ln=primefaces&pfdrid=ufpDFHhNpCx9dNk92OfD7uAPP6LjduXzuDwZf73cSco%3D&pfdrt=sc&pfdrid_c=true" alt="">
Firefox:
<img alt="" src="/appContext/javax.faces.resource/dynamiccontent.properties.xhtml?ln=primefaces&pfdrid=ufpDFHhNpCx9dNk92OfD7uAPP6LjduXzuDwZf73cSco%3D&pfdrt=sc&pfdrid_c=true" id="j_idt10">
IExplore DEV console says:
HTTP GET 200 44,29 KB 16 ms <img> for image
/appConctext/javax.faces.resource/dynamiccontent.properties.xhtml?ln=primefaces&pfdrid=ufpDFHhNpCx9dNk92OfD7uAPP6LjduXzuDwZf73cSco%3D&pfdrt=sc&pfdrid_c=true
Any help will be really appreciated. Thanks