Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see au.com.twobit.yosane.service.resource.impl.ImagesResource#getImageFile(java.lang.String)
  */
 @GET
 @Path("/{imageId}/file")
 @Produces("image/png")
 @CacheControl(maxAge = 1, maxAgeUnit = TimeUnit.MINUTES)
 @Relation(relation = "imageDownload", method = METHOD_GET_IMAGE_FILE)
 public Response getImageFile(@PathParam("imageId") String imageIdentifier) {
   try {
     storage.assertImageStatus(imageIdentifier, ImageStatus.READY);
     BufferedImage image = storage.loadImage(imageIdentifier);
     return Response.ok().entity(createByteArrayFromImage(image, png.name())).build();
   } catch (Exception x) {
     return Response.serverError().build();
   }
 }