I’m using streamedcontent to render a byte sent from JSF then send it back as a streamed content as following:
<p:graphicImage value="#{manage.bytesToStreamedContent(car.image)}"/>
where image is the byte array of the image stored in the database
backing bean:
public StreamedContent bytesToStreamedContent(byte[] bytes)
{
InputStream is = new ByteArrayInputStream(bytes);
StreamedContent image = new DefaultStreamedContent (is, "image/jpeg");
return image;
}
But I’m not getting the image in the JSF page. I got this message appearing in the server log:
WARNING: JSF1091: No mime type could be found for file dynamiccontent. To resolve this, add a mime-type mapping to the applications web.xml.
and:
SEVERE: Error in streaming dynamic resource.
can you please help me out here, I cant find any useful info regarding this issue
PS:
Im using the following libraries:
Mojarra 2.1.3
PrimeFaces 3.1.1
Glassfish 3.1
Found where the problem was. The problem wasn’t in the graphicimage. It was because the graphicimage tag is being loaded dynamically (similar issue when trying loading from datatable). Dynamic images cannot be rendered directly in datatable or datagrid. (Workaround is to assign a param and bring the images from the id).
However, the solution is here