@GET
@Path("/images/{id}.{type}")
public StreamingOutput getImages(@Context final HttpServletResponse response, @Context HttpServletRequest request, @PathParam("id") long id) throws IOException {
byte[] info = null;
File file = new File("d://test" + id + ".png");
if (!file.exists()) {
TeamInfo inofo = teamInfoService.fetch(id);
info = inofo.getLogo();
file = getFileFromBytes(info, "d://test" + id + ".png");
} else {
info = IOUtils.toByteArray(new FileInputStream("d://test" + id + ".png"));
}
InputStream imageIn = new ByteArrayInputStream(info);
ImageIO.write(ImageIO.read(imageIn), "png", response.getOutputStream());
imageIn.close();
response.getOutputStream().flush();
response.getOutputStream().close();
return (StreamingOutput) response.getOutputStream();
}
@Path("/images/{id}.{type}")
public StreamingOutput getImages(@Context final HttpServletResponse response, @Context HttpServletRequest request, @PathParam("id") long id) throws IOException {
byte[] info = null;
File file = new File("d://test" + id + ".png");
if (!file.exists()) {
TeamInfo inofo = teamInfoService.fetch(id);
info = inofo.getLogo();
file = getFileFromBytes(info, "d://test" + id + ".png");
} else {
info = IOUtils.toByteArray(new FileInputStream("d://test" + id + ".png"));
}
InputStream imageIn = new ByteArrayInputStream(info);
ImageIO.write(ImageIO.read(imageIn), "png", response.getOutputStream());
imageIn.close();
response.getOutputStream().flush();
response.getOutputStream().close();
return (StreamingOutput) response.getOutputStream();
}