hi, I have stored image in database and I want it expose via rest. What is the best way?
@Path("/image/{imageId}.jpeg")
@Stateless
@Produces({"image/jpeg"})
public class ImageSource{
@PersistenceContext
EntityManager em;
@GET
public /* what */ getImage(@PathParam("imageId") Long imageId) throws IOException{
byte[] image = em.find(Entity1.class, imageId).getImage();
// something here
}
}