1import org.apache.commons.io.FilenameUtils;
2
3@GET
4@Path("/images/{image}")
5@Produces("images/*")
6public Response getImage(@javax.ws.rs.PathParam("image") String image) {
7 File file = new File("resources/images/", FilenameUtils.getName(image)); //Fix
8
9 if (!file.exists()) {
10 return Response.status(Status.NOT_FOUND).build();
11 }
12
13 return Response.ok().entity(new FileInputStream(file)).build();
14}