Olá a todos.
Gostaria de saber se existe alguma forma de pegar uma imagem dos sistema com
estou utilizando o metodo para gravar no temp:
public class ArtistaManagedBean {
private Artista artista;
private BufferedImage buffImage;
private String way;
public BufferedImage getBuffImage() {
BufferedImage img = null;
try {
img = ImageIO.read(new ByteArrayInputStream(artista.getImg()));
//img.setIcon(new ImageIcon(img));
File file = new File("").createTempFile("musicbay", "artista"); //colocando no temp
file.deleteOnExit();
System.out.println(file.getCanonicalPath());
setWay(file.getCanonicalPath()); // guardando caminho do arquivo
ImageIO.write(img, "JPG", file); // gravando arquivo
setBuffImage(img);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return buffImage;
}
Estou utilizando o componente
no entanto quando utilizo
<p:graphicImage value="#{artistaManagedBean.way}" />
ele tenta acessar a imagem a partir do servidor, buscando em:
[url]http://localhost:8080/musicbay/tmp/musicbay3270516868982733793artista[/url]
gostaria de saber se existe alguma método em que ele faça acesso direto ao arquivo temporário para buscar os arquivos.
desde já agradeço a todos.