View External Image to Server p: graphicImage

1

I'm using it this way: XHTML:

<p:graphicImage value="#{emitenteBean.myImage}"

Bean:

private StreamedContent myImage;  

try {  
FileInputStream fileInputStream = new FileInputStream("/Users/user/files/minhaImg.jpg");  
myImage = new DefaultStreamedContent(fileInputStream, "image/jpeg");  

} catch (FileNotFoundException e) {  
  System.out.println("ERRO AO CONVERTER IMG.");  
}

Does not display the image and does not display an error.

    
asked by anonymous 18.10.2016 / 21:29

2 answers

0

Tomcat file: openfiscal#uploadsopenfiscal.xml

Tomcat Aquivo Content:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" docBase="/Users/jeremias/Downloads/uploadsopenfiscal" path="/arquivosupload">
  <Resource auth="Container" factory="org.jboss.weld.resources.ManagerObjectFactory" name="BeanManager" type="javax.enterprise.inject.spi.BeanManager"/>
</Context>

getCaminhoImage: "../arquivosupload/cliente/minhaImage.jpg"

XHTML: <p:graphicImage value="#{emitenteBean.emitente.logo.caminhoImagem}"

In Chrome: src="../arquivosupload/cliente/minhaImage.jpg?pfdrid_c=false&uid=89c637b7-24a1-439f-a89d-a3e17afe7399"

    
19.10.2016 / 02:17
0

Resolved only by mapping through Eclipse directly to tomcat. My question came as I take this into production since I mapped the directory inside the eclipse. In addition to the generated file within Catalina / localhost as informed another post.

    
19.10.2016 / 02:42